improve capture and add example
This commit is contained in:
parent
5ae8a8bcfd
commit
7c037d2490
1 changed files with 4 additions and 1 deletions
|
@ -38,7 +38,10 @@ def getpage(url):
|
||||||
pagecount = 1
|
pagecount = 1
|
||||||
for link in resp.links.values():
|
for link in resp.links.values():
|
||||||
if link['rel'] == 'last':
|
if link['rel'] == 'last':
|
||||||
pagecount = int(re.search('page=(.+)', link['url']).group(1))
|
# we extract the pagecount from the `page` param of the last url
|
||||||
|
# in the response, eg
|
||||||
|
# 'https://api.github.com/repositories/24998719/issues?state=all&labels=proposal&page=10'
|
||||||
|
pagecount = int(re.search('page=(\d+)', link['url']).group(1))
|
||||||
|
|
||||||
val = resp.json()
|
val = resp.json()
|
||||||
if not isinstance(val, list):
|
if not isinstance(val, list):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue