import aiohttp async def fetch(url): async with aiohttp.ClientSession() as session: async with session.get(url) as resp: try: data = await resp.json() except: data = await resp.text() return data