Skip to content

Help me understanding the return order of asession.run #480

Open
@z3ch5

Description

@z3ch5

from requests_html import AsyncHTMLSession
import functools

async def get_link(link):
r = await asession.get(link)
f = str(r) + link
return f

asession = AsyncHTMLSession()

links = [
'https://google.com',
'https://yahoo.com',
'https://python.org'
]

links = [
functools.partial(get_link, link) for link in links
]

print(links)

results = asession.run(*links)

print(results)

What I get is :
[functools.partial(<function get_link at 0x7fa59c438040>, 'https://google.com'), functools.partial(<function get_link at 0x7fa59c438040>, 'https://yahoo.com'), functools.partial(<function get_link at 0x7fa59c438040>, 'https://python.org')]
['<Response [200]>https://python.org', '<Response [200]>https://google.com', '<Response [200]>https://yahoo.com']

So why did the list of asession.run return in wrong order? is there a way to get the result in the same order they being send?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions