Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 1
    Thanks a million! Accepting your answer, but... 1. there's still a typo with the placement of the parenthesis. I'll edit it if you don't mind. 2. It looks to me like to print the actual result the line print(html) is deceiving and you actually need something like print('\n'.join(list((str(some_task._result) for some_tuple in html for some_task in some_tuple)))), maybe that could be added to the answer? 3. This seems really useful, I'd recommend adding something like this to readthedocs. Thanks again! :) Commented Mar 9, 2016 at 23:01
  • 1
    Andrew, where can I put a test like if response.status == 200? If one url does not exist, the script breaks, and I am not understanding where to check the response within the async with session.get(url) as response: return await response.text() Commented Mar 10, 2016 at 10:32
  • Thank you to the other person who left a comment before. I have started a new question to clarify this. Commented Mar 10, 2016 at 20:46
  • Updated to aiohttp 3.x and python 3.7 usage Commented Aug 30, 2018 at 6:37
  • 3
    the asyncio.create_task part is not necessary. Task is created from the coroutine in 3.7. Commented Dec 26, 2018 at 10:23