Set a timeout.
This commit is contained in:
parent
5dcbc00989
commit
d7ee1637df
@ -62,9 +62,9 @@ def do_http(method, url, body=b""):
|
||||
assert body.read
|
||||
scheme, host, port, path = parse_url(url)
|
||||
if scheme == "http":
|
||||
c = http_client.HTTPConnection(host, port)
|
||||
c = http_client.HTTPConnection(host, port, timeout=60)
|
||||
elif scheme == "https":
|
||||
c = http_client.HTTPSConnection(host, port)
|
||||
c = http_client.HTTPSConnection(host, port, timeout=60)
|
||||
else:
|
||||
raise ValueError("unknown scheme '%s', need http or https" % scheme)
|
||||
c.putrequest(method, path)
|
||||
|
Loading…
Reference in New Issue
Block a user