mirror of
https://github.com/Balshgit/github_mirror.git
synced 2025-09-11 22:40:44 +03:00
change git domain to ru
This commit is contained in:
parent
db44942894
commit
1162cb2fb3
@ -25,7 +25,7 @@ Use python version > 3.8
|
|||||||
- ```Please provide github token to get access to private repositories``` [github tokens](https://github.com/settings/tokens)
|
- ```Please provide github token to get access to private repositories``` [github tokens](https://github.com/settings/tokens)
|
||||||
|
|
||||||
|
|
||||||
- -l GITURL, --giturl GITURL ```Provide git url. Default link``` https://git.mywistr.com
|
- -l GITURL, --giturl GITURL ```Provide git url. Default link``` https://git.mywistr.ru
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
GIT_URL = 'https://git.mywistr.com'
|
GIT_URL = 'https://git.mywistr.ru'
|
||||||
|
|
||||||
USAGE = '''github_mirror [-h] [-g GROUP] (-u URLS [URLS ...] | -f FILE) -t TOKEN [-T GitHubTOKEN]
|
USAGE = '''github_mirror [-h] [-g GROUP] (-u URLS [URLS ...] | -f FILE) -t TOKEN [-T GitHubTOKEN]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
@ -9,13 +9,13 @@ from core.utils import logger
|
|||||||
|
|
||||||
class RepositoryCreator:
|
class RepositoryCreator:
|
||||||
|
|
||||||
def __init__(self, gitlab_url: str, headers: dict):
|
def __init__(self, git_url: str, headers: dict):
|
||||||
self.gitlab_url = gitlab_url
|
self.git_url = git_url
|
||||||
self.headers = headers
|
self.headers = headers
|
||||||
self.HTTP_201_CREATED = 201
|
self.HTTP_201_CREATED = 201
|
||||||
self.HTTP_200_OK = 200
|
self.HTTP_200_OK = 200
|
||||||
|
|
||||||
def __gitlab_request(self, method: str, url: str, data: dict = None) -> Union[Response, None]:
|
def __git_request(self, method: str, url: str, data: dict = None) -> Union[Response, None]:
|
||||||
"""
|
"""
|
||||||
Create request to gitlab
|
Create request to gitlab
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class RepositoryCreator:
|
|||||||
if auth_token:
|
if auth_token:
|
||||||
git_data['auth_token'] = auth_token
|
git_data['auth_token'] = auth_token
|
||||||
|
|
||||||
request = self.__gitlab_request('POST', f'{self.gitlab_url}/api/v1/repos/migrate', git_data)
|
request = self.__git_request('POST', f'{self.git_url}/api/v1/repos/migrate', git_data)
|
||||||
try:
|
try:
|
||||||
if request.status_code == self.HTTP_201_CREATED:
|
if request.status_code == self.HTTP_201_CREATED:
|
||||||
repo_data = request.json()
|
repo_data = request.json()
|
||||||
|
@ -24,10 +24,10 @@ def main():
|
|||||||
# parse gitlab group of repositories if it exists
|
# parse gitlab group of repositories if it exists
|
||||||
group_id = args.group if args.group else None
|
group_id = args.group if args.group else None
|
||||||
|
|
||||||
git_url = args.giturl # if not provided used default value https://git.mywistr.com
|
git_url = args.giturl # if not provided used default value https://git.mywistr.ru
|
||||||
headers = {'Authorization': f'token {args.token}'} # git user token must be provided
|
headers = {'Authorization': f'token {args.token}'} # git user token must be provided
|
||||||
|
|
||||||
repository_creator = RepositoryCreator(gitlab_url=git_url, headers=headers)
|
repository_creator = RepositoryCreator(git_url=git_url, headers=headers)
|
||||||
|
|
||||||
github_token = args.githubtoken if args.githubtoken else None # used for access to personal GitHub repositories
|
github_token = args.githubtoken if args.githubtoken else None # used for access to personal GitHub repositories
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user