mirror of
https://github.com/varunsridharan/github-gitea-mirror.git
synced 2024-09-11 17:56:39 +03:00
Improved.
This commit is contained in:
parent
7e17e6f772
commit
1e4f9fcc77
@ -1,2 +1,7 @@
|
||||
# github-gitea-mirror
|
||||
Simple Python Script To Mirror Repository From Github To Gitea
|
||||
# Github To Gitea Mirror
|
||||
Simple Python Script To Mirror Repository / Gist From Github To Gitea
|
||||
|
||||
## Why ?
|
||||
|
||||
## Usage
|
||||
|
||||
|
10
helper.py
10
helper.py
@ -6,6 +6,7 @@ import json
|
||||
import sys
|
||||
import os
|
||||
|
||||
giteaGetUserCache = dict()
|
||||
THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
|
||||
config = json.loads(open(os.path.expanduser("{0}/config.json".format(THIS_FOLDER))).read().strip())
|
||||
|
||||
@ -72,10 +73,15 @@ def giteaCreateOrg(orgname):
|
||||
if r.status_code != 201:
|
||||
return 'failed'
|
||||
|
||||
return json.loads(r.text)["id"]
|
||||
giteaGetUserCache["{0}".format(orgname)] = json.loads(r.text)["id"]
|
||||
return giteaGetUserCache[orgname]
|
||||
|
||||
def giteaGetUser(username):
|
||||
if username in giteaGetUserCache:
|
||||
return giteaGetUserCache[username]
|
||||
|
||||
r = session.get(giteaHost('users/{0}'.format(username)))
|
||||
if r.status_code != 200:
|
||||
return 'failed'
|
||||
return json.loads(r.text)["id"]
|
||||
giteaGetUserCache["{0}".format(username)] = json.loads(r.text)["id"]
|
||||
return giteaGetUserCache[username]
|
@ -57,5 +57,4 @@ for repo in gh.get_user().get_gists():
|
||||
topics.append('public-{0}-gist'.format(repo_owner))
|
||||
giteaSetRepoTopics(repo_owner,m["repo_name"],topics)
|
||||
|
||||
print(" ")
|
||||
exit(1)
|
||||
print(" ")
|
Loading…
Reference in New Issue
Block a user