catch async exceptions in utils.http.request_many()
This commit is contained in:
parent
078681eddf
commit
b62ba469d7
1 changed files with 6 additions and 1 deletions
|
@ -121,7 +121,12 @@ def request_many(urls: typing.List[str]) -> typing.Dict[str, Response]:
|
||||||
client = tornado.httpclient.AsyncHTTPClient()
|
client = tornado.httpclient.AsyncHTTPClient()
|
||||||
request = tornado.httpclient.HTTPRequest(url, method="GET",
|
request = tornado.httpclient.HTTPRequest(url, method="GET",
|
||||||
connect_timeout=2, request_timeout=2)
|
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))
|
headers = utils.CaseInsensitiveDict(dict(response.headers))
|
||||||
data = response.body.decode("utf8")
|
data = response.body.decode("utf8")
|
||||||
|
|
Loading…
Reference in a new issue