From ef632a10b52b1a62113f14182883435b706c51f2 Mon Sep 17 00:00:00 2001 From: Dylan Dizon Date: Sat, 3 Nov 2018 17:04:52 -0400 Subject: [PATCH] Fix aiohttp warning for ClientSession outside of async construct --- src/utils/utils.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/utils.py b/src/utils/utils.py index 1410e49..64bc89d 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -88,17 +88,17 @@ secrets = setdefault('secrets.json', default={'client_secrets': {'client_id': '' cogs = {} color = d.Color(0x1A1A1A) -session = aiohttp.ClientSession() last_commands = {} async def fetch(url, *, params={}, json=False, response=False): - async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modufur'}) as r: - if response: - return r - elif json: - return await r.json() - return await r.read() + async with aiohttp.ClientSession() as session: + async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modufur'}, ssl=False) as r: + if response: + return r + elif json: + return await r.json() + return await r.read() # async def clear(obj, interval=10 * 60, replace=None):