update
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
from .config import GiteaConfig
|
||||
from .api import GiteaApi
|
||||
|
||||
__all__ = ["GiteaConfig", "GiteaApi"]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
import giteapy
|
||||
from .config import GiteaConfig
|
||||
|
||||
|
||||
class GiteaApi:
|
||||
|
||||
def __init__(self):
|
||||
self.config = GiteaConfig().configuration
|
||||
|
||||
def admin_gitea_instance(self):
|
||||
return giteapy.AdminApi(giteapy.ApiClient(self.config))
|
||||
|
||||
def repo_gitea_instance(self):
|
||||
return giteapy.RepositoryApi(giteapy.ApiClient(self.config))
|
||||
|
||||
def user_gitea_instance(self):
|
||||
return giteapy.UserApi(giteapy.ApiClient(self.config))
|
||||
|
||||
def org_gitea_instance(self):
|
||||
return giteapy.OrganizationApi(giteapy.ApiClient(self.config))
|
||||
|
||||
def misc_gitea_instance(self):
|
||||
return giteapy.MiscellaneousApi(giteapy.ApiClient(self.config))
|
||||
|
||||
def issue_gitea_instance(self):
|
||||
return giteapy.IssueApi(giteapy.ApiClient(self.config))
|
||||
@@ -0,0 +1,14 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
import giteapy
|
||||
|
||||
# Automatically look for .env in the project root
|
||||
load_dotenv()
|
||||
|
||||
|
||||
class GiteaConfig:
|
||||
def __init__(self):
|
||||
self.configuration = giteapy.Configuration()
|
||||
self.configuration.host = os.getenv("GITEA_HOST")
|
||||
self.configuration.api_key["Authorization"] = os.getenv("GITEA_ACCESS_TOKEN")
|
||||
self.configuration.api_key_prefix["Authorization"] = "Bearer"
|
||||
Reference in New Issue
Block a user