forked from astroid-app/v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue with false
except
which always returned an error instea…
…d 404
- Loading branch information
1 parent
51530bc
commit 24b6937
Showing
9 changed files
with
230 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ fastapi | |
uvicorn | ||
voltage=<0.1.5a8 | ||
re | ||
surrealdb | ||
aiohttp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import astroidapi.surrealdb_handler as surrealdb_handler | ||
import asyncio | ||
import astroidapi.errors as errors | ||
import json | ||
|
||
|
||
class HealthCheck: | ||
|
||
class EndpointCheck: | ||
|
||
@classmethod | ||
async def check(cls, endpoint): | ||
healthy_endpoint_data = { | ||
"config": { | ||
"self-user": False, | ||
"webhooks": { | ||
"discord": [], | ||
"guilded": [], | ||
"revolt": [], | ||
"nerimity": [] | ||
}, | ||
"channels": { | ||
"discord": [], | ||
"guilded": [], | ||
"revolt": [], | ||
"nerimity": [] | ||
}, | ||
"logs": { | ||
"discord": None, | ||
"guilded": None, | ||
"revolt": None, | ||
"nerimity": None | ||
}, | ||
"blacklist": [], | ||
"allowed-ids": [], | ||
"isbeta": False | ||
}, | ||
"meta": { | ||
"sender-channel": None, | ||
"trigger": False, | ||
"sender": None, | ||
"read": { | ||
"discord": False, | ||
"guilded": False, | ||
"revolt": False, | ||
"nerimity": False | ||
}, | ||
"message": { | ||
"author": { | ||
"name": None, | ||
"avatar": None, | ||
"id": None | ||
}, | ||
"content": None, | ||
"attachments": [] | ||
} | ||
} | ||
} | ||
try: | ||
endpoint_data = await surrealdb_handler.get_endpoint(endpoint) | ||
for key in healthy_endpoint_data["config"].keys(): | ||
if key not in endpoint_data["config"]: | ||
raise errors.HealtCheckError.EndpointCheckError.EndpointConfigError(f"'{key}' not found in endpoint '{endpoint}'") | ||
for key in healthy_endpoint_data["meta"].keys(): | ||
if key not in endpoint_data["meta"]: | ||
raise errors.HealtCheckError.EndpointCheckError.EndpointMetaDataError(f"'{key}' not found in endpoint '{endpoint}'") | ||
return True | ||
except IndexError as e: | ||
raise errors.HealtCheckError.EndpointCheckError(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters