Skip to content

Instantly share code, notes, and snippets.

@atelic
Created November 11, 2016 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atelic/dbe221cb009843ef4cd91e7bfcf19540 to your computer and use it in GitHub Desktop.
Save atelic/dbe221cb009843ef4cd91e7bfcf19540 to your computer and use it in GitHub Desktop.
import json
import requests
RPP = 'ezcuj'
CONTRIBUTORS_URL = 'https://api.osf.io/v2/nodes/{}/contributors/'
def get_contribs(url):
contributors_to_add = []
resp = requests.get(url).json()
contributors = resp['data']
for contrib in contributors:
contributors_to_add.append(contrib['embeds']['users']['data']['id'])
next_url = resp['links']['next']
if next_url:
contributors_to_add += get_contribs(next_url)
return contributors_to_add
add = get_contribs(CONTRIBUTORS_URL.format(RPP))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment