Created
July 10, 2024 19:16
-
-
Save edsu/9b5375b9548b14272303054f857b5156 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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