Add timeout exception

This commit is contained in:
Andros Fenollosa 2019-10-10 21:32:51 +02:00
parent 058230c9d3
commit 28dac9ad47

View File

@ -15,8 +15,12 @@
(defn wordpress?
"Check if a web page is generated with WordPress"
[url]
(let [response (client/get (str "http://" url "/") {:ignore-unknown-host? true, :connection-timeout 5000, :throw-exceptions false})]
(every? identity [(re-find (re-pattern "meta.*generator.*WordPress") (:body response))])))
(try
(let [response (client/get (str "http://" url "/") {:ignore-unknown-host? true, :connection-timeout 5000, :throw-exceptions false})]
(every? identity [(re-find (re-pattern "meta.*generator.*WordPress") (:body response))]))
(catch Exception e
"timeout"
)))
(defn -main
[& args]