Set a timeout.

This commit is contained in:
Itamar Turner-Trauring 2023-04-14 10:22:06 -04:00
parent 5dcbc00989
commit d7ee1637df

View File

@ -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)