From 030f56c031c9d0015d39df0e11b5000c01ae5788 Mon Sep 17 00:00:00 2001 From: John Slee Date: Tue, 15 Oct 2013 01:07:34 +1100 Subject: [PATCH] add support for OAuth tokens --- github-backup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/github-backup.py b/github-backup.py index fe3ea84..53a282e 100755 --- a/github-backup.py +++ b/github-backup.py @@ -27,6 +27,12 @@ def main(): config['password'] = args.password config['login'] = args.username + # if both password and token are specified, the token will be + # used, according to pygithub3 sources + # however, the username isn't required when using a token + if (args.token): + config['token'] = args.token + gh = Github(**config) # Get all of the given user's repos @@ -57,6 +63,7 @@ def init_parser(): parser.add_argument("-P","--prefix", help="Add prefix to repository directory names", default="") parser.add_argument("-o","--organization", help="Backup Organizational repositories") parser.add_argument("-S","--ssh", help="Use SSH protocol", action="store_true") + parser.add_argument("-t","--token", help="Authenticate with Github API using OAuth token", default="") return parser