Apologies on the hackyness of this but I just wanted to show what I guess is the current way to deal with pagination:
gh = GitHub(username=user, access_token=api_key)
page = 1
repos = []
while True:
print('page {}'.format(page))
result = gh.user.repos.get(page=page)
if len(result) > 0:
repos = repos + result
page = page + 1
else:
break
template = ' {} {}'
print(template.format('NAME', 'SSH URL'))
for repo in repos:
print(template.format(repo['name'], repo['ssh_url']))
Like I said, kinda messy but would be better if there was some way to get info. It's returned in the link header per the docs and this wouldn't work with the commits api because it's based on sha hashes. It is also possible to set per_page=100 which would solve it in my case (have 50ish) but I'm sure others that are more fork happy would easily exceed that.
Apologies on the hackyness of this but I just wanted to show what I guess is the current way to deal with pagination:
Like I said, kinda messy but would be better if there was some way to get info. It's returned in the link header per the docs and this wouldn't work with the commits api because it's based on sha hashes. It is also possible to set
per_page=100which would solve it in my case (have 50ish) but I'm sure others that are more fork happy would easily exceed that.