Fetching multiple urls with aiohttp in python
问题 In a previous question, a user suggested the following approach for fetching multiple urls (API calls) with aiohttp : import asyncio import aiohttp url_list = ['https://api.pushshift.io/reddit/search/comment/?q=Nestle&size=30&after=1530396000&before=1530436000', 'https://api.pushshift.io/reddit/search/comment/?q=Nestle&size=30&after=1530436000&before=1530476000'] async def fetch(session, url): async with session.get(url) as response: return await response.json()['data'] async def fetch_all