Created
November 11, 2016 19:00
-
-
Save atelic/dbe221cb009843ef4cd91e7bfcf19540 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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