From f7abffe69ba0d11bd58397024ed60c9c207bafe3 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 25 Oct 2013 10:58:22 +0200 Subject: [PATCH] added support for oauth token and fixed little bug in pygithub3 configuration --- github-backup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/github-backup.py b/github-backup.py index ae95f33..7645317 100755 --- a/github-backup.py +++ b/github-backup.py @@ -23,6 +23,11 @@ def main(): # Make the connection to Github here. config = { 'user': args.username } + args.backupdir = args.backupdir.rstrip("/") + + if (args.token): + config['token'] = args.token + if (args.password): config['password'] = args.password config['login'] = args.username @@ -30,7 +35,7 @@ def main(): gh = Github(**config) # Get all of the given user's repos - user_repos = gh.repos.list().all() + user_repos = gh.repos.list(user=args.username).all() for repo in user_repos: repo.user = gh.users.get(repo.owner.login) process_repo(repo, args) @@ -50,6 +55,7 @@ def init_parser(): parser.add_argument("-g","--git", help="Pass extra arguments to git", default="", metavar="ARGS") parser.add_argument("-s", "--suffix", help="Add suffix to repository directory names", default="") parser.add_argument("-p", "--password", help="Authenticate with Github API") + parser.add_argument("-t", "--token", help="OAuth token for authentification") return parser