mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 22:27:28 +00:00
Fix aiohttp warning for ClientSession outside of async construct
This commit is contained in:
parent
c51353df76
commit
ef632a10b5
1 changed files with 7 additions and 7 deletions
|
@ -88,17 +88,17 @@ secrets = setdefault('secrets.json', default={'client_secrets': {'client_id': ''
|
||||||
|
|
||||||
cogs = {}
|
cogs = {}
|
||||||
color = d.Color(0x1A1A1A)
|
color = d.Color(0x1A1A1A)
|
||||||
session = aiohttp.ClientSession()
|
|
||||||
last_commands = {}
|
last_commands = {}
|
||||||
|
|
||||||
|
|
||||||
async def fetch(url, *, params={}, json=False, response=False):
|
async def fetch(url, *, params={}, json=False, response=False):
|
||||||
async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modufur'}) as r:
|
async with aiohttp.ClientSession() as session:
|
||||||
if response:
|
async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modufur'}, ssl=False) as r:
|
||||||
return r
|
if response:
|
||||||
elif json:
|
return r
|
||||||
return await r.json()
|
elif json:
|
||||||
return await r.read()
|
return await r.json()
|
||||||
|
return await r.read()
|
||||||
|
|
||||||
|
|
||||||
# async def clear(obj, interval=10 * 60, replace=None):
|
# async def clear(obj, interval=10 * 60, replace=None):
|
||||||
|
|
Loading…
Reference in a new issue