lister: Support multiple credentials
This commit is contained in:
parent
4d53974e0c
commit
0331ba4c7b
2 changed files with 17 additions and 4 deletions
15
bin/ghlister
15
bin/ghlister
|
@ -100,6 +100,21 @@ def read_conf(args):
|
|||
else:
|
||||
conf['cache_json'] = False
|
||||
|
||||
if 'credentials' in conf:
|
||||
credentials = conf['credentials'].split()
|
||||
conf['credentials'] = []
|
||||
for user_pair in credentials:
|
||||
username, password = user_pair.split(':')
|
||||
conf['credentials'].append({
|
||||
'username': username,
|
||||
'password': password,
|
||||
})
|
||||
else:
|
||||
conf['credentials'] = [{
|
||||
'username': conf['username'],
|
||||
'password': conf['password'],
|
||||
}]
|
||||
|
||||
return conf
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import gzip
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import requests
|
||||
import time
|
||||
|
@ -130,10 +131,7 @@ def fetch(conf, mk_session, min_id=None, max_id=None):
|
|||
max_id = float('inf')
|
||||
next_id = min_id
|
||||
|
||||
cred = {}
|
||||
for key in ['username', 'password']:
|
||||
if key in conf:
|
||||
cred[key] = conf[key]
|
||||
cred = random.choice(conf['credentials'])
|
||||
|
||||
while min_id <= next_id <= max_id:
|
||||
logging.info('listing repos starting at %d' % next_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue