How to do parallel requests using python?
My code so far:
x = ("address")
x.signin(signin.request())
# this code signs in the user and generate the response how to do a parallel response.
Looked into those but couldn't figure out where to use that
import asyncio
import requests
async def main():
loop = asyncio.get_event_loop()
futures = [
loop.run_in_executor(
None,
requests.get,
'http://example.org/'
)
for i in range(20)
]
for response in await asyncio.gather(*futures):
pass
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
looked into this thread also:
What is the fastest way to send 100,000 HTTP requests in Python?