aboutsummaryrefslogtreecommitdiff
path: root/src/utils/http.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-07-08 13:59:48 +0100
committerGravatar jesopo2019-07-08 13:59:48 +0100
commita1438abf66c25ee112a8abbbe13e450390cabfb4 (patch)
tree6052bd5664fb061aebfb7c8db6b8b2618d73f1cd /src/utils/http.py
parentDon't try/except async http exceptions (diff)
signature
close event loop when we're done with it (request_many())
Diffstat (limited to 'src/utils/http.py')
-rw-r--r--src/utils/http.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utils/http.py b/src/utils/http.py
index 15f371fe..88edeb46 100644
--- a/src/utils/http.py
+++ b/src/utils/http.py
@@ -127,12 +127,13 @@ def request_many(urls: typing.List[str]) -> typing.Dict[str, Response]:
data = response.body.decode("utf8")
responses[url] = Response(response.code, data, headers)
- loop = asyncio.get_event_loop()
+ loop = asyncio.new_event_loop()
awaits = []
for url in urls:
awaits.append(_request(url))
task = asyncio.gather(*awaits, return_exceptions=True)
loop.run_until_complete(task)
+ loop.close()
return responses