catch async exceptions in utils.http.request_many()

This commit is contained in:
jesopo 2019-07-08 13:18:59 +01:00
parent 078681eddf
commit b62ba469d7

View file

@ -121,7 +121,12 @@ def request_many(urls: typing.List[str]) -> typing.Dict[str, Response]:
client = tornado.httpclient.AsyncHTTPClient()
request = tornado.httpclient.HTTPRequest(url, method="GET",
connect_timeout=2, request_timeout=2)
response = await client.fetch(request)
response = None
try:
response = await client.fetch(request)
except:
return
headers = utils.CaseInsensitiveDict(dict(response.headers))
data = response.body.decode("utf8")