1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 21:02:38 +00:00

Change fetch logic to be more logical

This commit is contained in:
Myned 2019-10-01 21:59:00 -04:00
parent 65329b81d4
commit 78c78c61d1
No known key found for this signature in database
GPG key ID: BC58C09870A63E59

View file

@ -87,10 +87,10 @@ asession = aiohttp.ClientSession()
async def fetch(url, *, params={}, json=False, response=False, text=False): async def fetch(url, *, params={}, json=False, response=False, text=False):
async with asession.get(url, params=params, headers={ async with asession.get(url, params=params, headers={
'User-Agent': 'Myned/Modufur (https://github.com/Myned/Modufur)'}, ssl=False) as r: 'User-Agent': 'Myned/Modufur (https://github.com/Myned/Modufur)'}, ssl=False) as r:
if json: if response:
return await r.json()
elif response:
return r return r
elif json:
return await r.json()
elif text: elif text:
return await r.text() return await r.text()
else: else: