Skip to content

Instantly share code, notes, and snippets.

@niconoe
Created May 19, 2020 13:10
Show Gist options
  • Save niconoe/b9dcb6c468b996b6f77e18f51516e840 to your computer and use it in GitHub Desktop.
Save niconoe/b9dcb6c468b996b6f77e18f51516e840 to your computer and use it in GitHub Desktop.
def paginated_name_usage(*args, **kwargs):
PER_PAGE = 100
from pygbif import species
results = []
offset = 0
while True:
resp = species.name_usage(*args, **kwargs, limit=PER_PAGE, offset=offset)
results = results + resp['results']
if resp['endOfRecords']:
break
else:
offset = offset + PER_PAGE
return results
res = paginated_name_usage(key=2407434, data='children')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment