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

Add e621 API key to fix content being blocked without an account

This commit is contained in:
Myned 2020-03-11 17:00:30 -04:00
parent fc3483fec8
commit a5438a1056
No known key found for this signature in database
GPG key ID: 2EF9C0C44229D034

View file

@ -23,7 +23,7 @@ try:
except FileNotFoundError: except FileNotFoundError:
with open('config.json', 'w') as outfile: with open('config.json', 'w') as outfile:
jsn.dump({'client_id': 0, 'owner_id': 0, 'permissions': 126016, jsn.dump({'client_id': 0, 'owner_id': 0, 'permissions': 126016,
'playing': 'a game', 'prefix': [',', 'm,'], 'selfbot': False, 'token': 'str', 'saucenao_api': 'str'}, outfile, indent=4, sort_keys=True) 'playing': 'a game', 'prefix': [',', 'm,'], 'selfbot': False, 'token': 'str', 'saucenao_api': 'str', 'e621_api': 'str'}, outfile, indent=4, sort_keys=True)
print('FILE NOT FOUND : config.json created with default values. Restart run.py with correct values') print('FILE NOT FOUND : config.json created with default values. Restart run.py with correct values')
@ -84,8 +84,10 @@ last_commands = {}
asession = aiohttp.ClientSession() asession = aiohttp.ClientSession()
async def fetch(url, *, params={}, json=False, response=False, text=False): async def fetch(url, *, json=False, response=False, text=False):
async with asession.get(url, params=params, headers={ if 'e621' in url or 'e926' in url:
url += f'&login=BotMyned&api_key={config["e621_api"]}'
async with asession.get(url, 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 response: if response:
return r return r