feat!: token support for cloning

This commit is contained in:
2026-06-27 22:57:58 +03:00
parent 28f1fda048
commit 206a8730a8
11 changed files with 336 additions and 45 deletions
+4 -4
View File
@@ -9,16 +9,16 @@ REPOSITORIES_ADAPTER = TypeAdapter(list[GiteaRepository])
class GiteaApi:
def __init__(self, endpoint: str, token: str):
self._endpoint = endpoint
self._token = token
def __init__(self, endpoint: str, api_token: str):
self._endpoint = str(endpoint)
self._api_token = api_token
def get_repositories(self, page_size=10) -> list[GiteaRepository]:
"""
For mirroring input user is not important.
"""
session = requests.session()
session.headers.update({"Authorization": "token " + self._token})
session.headers.update({"Authorization": "token " + self._api_token})
all_repos = {} # hack for unique repositories in result
page_id = 1
while True: