Bulk asynchronous processing of URLs using the aiohttp package.
pip install aiohttpmap
import asyncio
from aiohttpmap import AiohttpMap
urls = ['https://api.-placeholder-.com/endpoint']*10
loop = asyncio.get_event_loop()
try:
results = loop.run_until_complete(AiohttpMap().map(urls, request_type='get'))
finally:
loop.close()
import asyncio
from aiohttpmap import AiohttpMap
urls = ['https://api.-placeholder-.com/endpoint']*10
auth_header = {'Authorization': 'token...'}
loop = asyncio.get_event_loop()
try:
results = loop.run_until_complete(AiohttpMap().map(urls, request_type='get', headers=auth_header))
finally:
loop.close()