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