Define a timeout for all http requests
This commit is contained in:
parent
6d26a13752
commit
a2b273d09b
13 changed files with 12 additions and 12 deletions
|
|
@ -55,7 +55,7 @@ def parseanswer(msg):
|
|||
|
||||
|
||||
def getPage(terms, langfrom="fr", langto="en"):
|
||||
conn = http.client.HTTPConnection("api.wordreference.com")
|
||||
conn = http.client.HTTPConnection("api.wordreference.com", timeout=5)
|
||||
try:
|
||||
conn.request("GET", "/0.8/%s/json/%s%s/%s" % (CONF.getNode("wrapi")["key"], langfrom, langto, quote(terms)))
|
||||
except socket.gaierror:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue