mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-06 00:28:01 +01:00
Merge pull request #52 from bjodah/fix-gh-51
Support --token file:///home/user/token.txt (fixes gh-51)
This commit is contained in:
@@ -141,7 +141,7 @@ def parse_args():
|
|||||||
parser.add_argument('-t',
|
parser.add_argument('-t',
|
||||||
'--token',
|
'--token',
|
||||||
dest='token',
|
dest='token',
|
||||||
help='personal access or OAuth token')
|
help='personal access or OAuth token, or path to token (file://...)')
|
||||||
parser.add_argument('-o',
|
parser.add_argument('-o',
|
||||||
'--output-directory',
|
'--output-directory',
|
||||||
default='.',
|
default='.',
|
||||||
@@ -255,6 +255,10 @@ def get_auth(args, encode=True):
|
|||||||
auth = None
|
auth = None
|
||||||
|
|
||||||
if args.token:
|
if args.token:
|
||||||
|
_path_specifier = 'file://'
|
||||||
|
if args.token.startswith(_path_specifier):
|
||||||
|
args.token = open(args.token[len(_path_specifier):],
|
||||||
|
'rt').readline().strip()
|
||||||
auth = args.token + ':' + 'x-oauth-basic'
|
auth = args.token + ':' + 'x-oauth-basic'
|
||||||
elif args.username:
|
elif args.username:
|
||||||
if not args.password:
|
if not args.password:
|
||||||
|
|||||||
Reference in New Issue
Block a user