diff options
| author | 2019-07-08 13:18:59 +0100 | |
|---|---|---|
| committer | 2019-07-08 13:18:59 +0100 | |
| commit | b62ba469d7d99a1f1135eb9d2b21ea8f9f0a1efe (patch) | |
| tree | fc3688d5d31a6f3eb8b9cbb78e6937e9879fc230 /src/utils/http.py | |
| parent | add missing schema in utils.http.sanitise_url, use in rss.py (diff) | |
| signature | ||
catch async exceptions in utils.http.request_many()
Diffstat (limited to 'src/utils/http.py')
| -rw-r--r-- | src/utils/http.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/utils/http.py b/src/utils/http.py index 531c24fc..a8e8f05e 100644 --- a/src/utils/http.py +++ b/src/utils/http.py @@ -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") |
