mirror of
https://git.srhtnin.garden/sarah/SaraSuite.git
synced 2026-10-14 18:28:11 +02:00
Self-updates and program list from the repo
This commit is contained in:
1 parent
d9da8438c2
commit
e4272bd606
9 files changed
+416
-15
No files matched your search
+14
@@ -40,6 +40,20 @@ def _Get(Url: str) -> bytes:
|
||||
raise SourceError(f"Couldn't reach {Url}: {Error}") from Error
|
||||
|
||||
|
||||
def GetBytes(Url: str) -> bytes:
|
||||
return _Get(Url)
|
||||
|
||||
|
||||
def GetJson(Url: str):
|
||||
"""A JSON API response (e.g. Gitea's latest release), or SourceError."""
|
||||
import json
|
||||
|
||||
try:
|
||||
return json.loads(_Get(Url))
|
||||
except ValueError as Error:
|
||||
raise SourceError(f"{Url} didn't return JSON: {Error}") from Error
|
||||
|
||||
|
||||
def _RepoUrl(GitUrl: str) -> str:
|
||||
return GitUrl.rstrip("/").removesuffix(".git")
|
||||
|
||||
|
||||
Reference in new issue
Block a user