This commit is contained in:
mike
2024-06-18 00:57:09 -07:00
parent 17a6422b1b
commit 27a8f73390
3 changed files with 110 additions and 60 deletions

View File

@@ -7,9 +7,10 @@ class API:
__DEFAULT_API_PATH = "/api/v1"
def __init__(self):
def __init__(self, verify_ssl, ca_bundle):
pass
self.__verify_ssl = verify_ssl
self.__ca_bundle = ca_bundle
@staticmethod
def _make_api_base_url(hostname, port):
@@ -20,17 +21,23 @@ class API:
return base
@staticmethod
def factory(hostname, port, token) -> gitea.Gitea:
def get(self, hostname, port, token) -> gitea.Gitea:
url = API._make_api_base_url(
hostname=hostname,
port=port
)
ssl_verify_arg = True
if self.__verify_ssl is not None:
ssl_verify_arg = self.__verify_ssl
if self.__ca_bundle is not None:
ssl_verify_arg = self.__ca_bundle
g = gitea.Gitea(
gitea_url=url,
token_text=token
token_text=token,
verify=ssl_verify_arg
)
return g