diff --git a/migrate_to_gitea.py b/migrate_to_gitea.py index 8b97c71..eb87235 100644 --- a/migrate_to_gitea.py +++ b/migrate_to_gitea.py @@ -29,6 +29,9 @@ __provider_git = { 'repo_url' : 'web_url', }, } + +HEADERS = { "accept": "application/json", "content-type": "application/json" } + @click.group() def cli(): pass @@ -149,7 +152,6 @@ def list_repo(provider_git, team_org, verbose): def list_repo_token(domain, team_org, access_token, verbose): HOST = "https://%s/api/v1" % (domain) - HEADERS = { "accept": "application/json", "content-type": "application/json" } HEADERS["Authorization"] = "token %s" % (access_token) Gitea.listRepo(HOST, team_org, HEADERS, verbose) @@ -170,7 +172,6 @@ def mirror_repo(domain, provider_git, team_org_source, HOST = "https://%s/api/v1" % (domain) MIGRATE_URI = "/repos/migrate" ENDPOINT_MIGRATE = "%s%s" % (HOST, MIGRATE_URI) - HEADERS = { "accept": "application/json", "content-type": "application/json" } HEADERS["Authorization"] = "token %s" % (access_token) count = 0 for repo in repos: @@ -189,7 +190,6 @@ def get_branch_repo_gitea(domain, team_org, access_token, HOST = "https://%s/api/v1" % (domain) BRANCH_URI = "/repos/%s" % (team_org) ENDPOINT_BRANCH = "%s%s" % (HOST, BRANCH_URI) - HEADERS = { "accept": "application/json", "content-type": "application/json" } HEADERS["Authorization"] = "token %s" % (access_token) repos = Gitea.listRepo(HOST, team_org, HEADERS) for repo in repos: