mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:13:56 +01:00
a few more nice changes
This commit is contained in:
parent
f4a09515fe
commit
1da39e5242
|
@ -3,11 +3,14 @@
|
|||
import asyncio
|
||||
|
||||
async def invalidate_key(provider_and_key: str) -> none:
|
||||
"""Invalidates a key stored in the secret/ folder by storing it in the associated .invalid.txt file.
|
||||
The schmea in which <provider_and_key> should be passed is:
|
||||
<provider_name><key>, e.g.
|
||||
closed4>sk-...
|
||||
"""
|
||||
"""
|
||||
|
||||
Invalidates a key stored in the secret/ folder by storing it in the associated .invalid.txt file.
|
||||
The schmea in which <provider_and_key> should be passed is:
|
||||
<provider_name><key>, e.g.
|
||||
closed4>sk-...
|
||||
|
||||
"""
|
||||
|
||||
if not provider_and_key:
|
||||
return
|
||||
|
|
|
@ -96,12 +96,11 @@ async def stream(
|
|||
webhook = dhooks.Webhook(os.getenv('DISCORD_WEBHOOK__API_ISSUE'))
|
||||
webhook.send(content=f'API Issue: **`{exc}`**\nhttps://i.imgflip.com/7uv122.jpg')
|
||||
|
||||
error = await errors.yield_error(
|
||||
yield await errors.yield_error(
|
||||
500,
|
||||
'Sorry, the API has no working keys anymore.',
|
||||
'The admins have been messaged automatically.'
|
||||
)
|
||||
yield error
|
||||
return
|
||||
|
||||
for k, v in target_request.get('headers', {}).items():
|
||||
|
@ -180,12 +179,11 @@ async def stream(
|
|||
|
||||
except Exception as exc:
|
||||
if 'Connection closed' in str(exc):
|
||||
error = await errors.yield_error(
|
||||
yield await errors.yield_error(
|
||||
500,
|
||||
'Sorry, there was an issue with the connection.',
|
||||
'Please first check if the issue on your end. If this error repeats, please don\'t heistate to contact the staff!.'
|
||||
)
|
||||
yield error
|
||||
return
|
||||
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue