Skip to content

Instantly share code, notes, and snippets.

View Jason-Gush's full-sized avatar

Jason Gush Jason-Gush

  • @nz-mbie
  • New Zealand
View GitHub Profile
@Jason-Gush
Jason-Gush / Fetch work items from users in Hub with config.py
Last active June 1, 2021 03:20
Using the NZ ORCID Hub's API to compile ORCID works
# Python3.6
# Use an access token from the Hub to retrieve (all) users
# With the list of users, use the ORCID API proxy to retrieve their work summaries
# Done handle 401 responses by using a public read directly from ORCID
# Done change from json out to tsv
# Done make UTF-8 safe, much easier than I thought but seems to slow operation
# Done use time.sleep to control request/min and prevent overloading ORCID
# Was 8/sec now max 20/sec to be safe for V2 and V3)
# From the work summaries, call each work individually to get the needed metadata missing from the summary
# Write row at time to allow recovery from error and add skip_orcid to allow resume at specific ORCID ID