Last active
July 19, 2016 21:17
-
-
Save vanatteveldt/4ae7c7464c923008f8ff514228409577 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
def get_all_connections(graph, id, connection, **args): | |
# Warning: method has been slightly edited manually from actual use, so may contain typos/mistakes | |
while True: | |
page = graph.get_connections(id, connection, **args) | |
for item in page['data']: | |
yield item | |
next = page.get('paging', {}).get('next') | |
if not next: | |
return | |
args = urlparse.parse_qs(urlparse.urlparse(next).query) | |
del args['access_token'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment