Started refactoring to py-gitea

This commit is contained in:
mike
2024-06-17 23:45:40 -07:00
parent 16ab8a2ffd
commit 17a6422b1b
5 changed files with 245 additions and 78 deletions

36
domain/API.py Normal file
View File

@@ -0,0 +1,36 @@
import gitea
class API:
__DEFAULT_API_PATH = "/api/v1"
def __init__(self):
pass
@staticmethod
def _make_api_base_url(hostname, port):
base = f"https://{hostname}"
if port is not None:
base += f":{port}"
return base
@staticmethod
def factory(hostname, port, token) -> gitea.Gitea:
url = API._make_api_base_url(
hostname=hostname,
port=port
)
g = gitea.Gitea(
gitea_url=url,
token_text=token
)
return g