mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 13:02:38 +00:00
Add text argument to fetch util
This commit is contained in:
parent
9ab357e26f
commit
3741b0e694
1 changed files with 8 additions and 5 deletions
|
@ -85,13 +85,16 @@ color = d.Color(0x1A1A1A)
|
|||
last_commands = {}
|
||||
|
||||
|
||||
async def fetch(url, *, params={}, json=False, response=False):
|
||||
async def fetch(url, *, params={}, json=False, response=False, text=False):
|
||||
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:
|
||||
if json:
|
||||
return await r.json()
|
||||
elif response:
|
||||
return r
|
||||
elif text:
|
||||
return await r.text()
|
||||
else:
|
||||
return await r.read()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue