Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the return order of AsyncHTMLSession.run #531

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix the return order of AsyncHTMLSession.run
  • Loading branch information
acjh committed Feb 4, 2023
commit b7d5d7c69f0ae5a2899d52de6557ef00f92bbb4a
4 changes: 1 addition & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ Try async and get some sites at the same time:
... print(result.html.url)
...
https://www.python.org/
https://www.google.com/
https://www.reddit.com/

Note that the order of the objects in the results list represents the order they were returned in, not the order that the coroutines are passed to the ``run`` method, which is shown in the example by the order being different.
https://www.google.com/

Grab a list of all links on the page, as–is (anchors excluded):

Expand Down
4 changes: 2 additions & 2 deletions requests_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,5 +839,5 @@ def run(self, *coros):
tasks = [
asyncio.ensure_future(coro()) for coro in coros
]
done, _ = self.loop.run_until_complete(asyncio.wait(tasks))
return [t.result() for t in done]
_, _ = self.loop.run_until_complete(asyncio.wait(tasks))
return [t.result() for t in tasks]