Skip to content

Instantly share code, notes, and snippets.

@edsu
Created July 10, 2024 19:16
Show Gist options
  • Save edsu/9b5375b9548b14272303054f857b5156 to your computer and use it in GitHub Desktop.
Save edsu/9b5375b9548b14272303054f857b5156 to your computer and use it in GitHub Desktop.
import requests
author_id = 'https://openalex.org/A5067004024'
url = 'https://api.openalex.org/works'
params = {
'filter': f'author.id:{author_id}',
'cursor': '*'
}
resp_count = 0
while True:
resp_count += 1
resp = requests.get(url, params=params)
resp.raise_for_status()
results = resp.json()
if len(results['results']) == 0:
break
else:
print(f"found {len(results['results'])} in response {resp_count}")
params['cursor'] = results['meta']['next_cursor']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment