Created
June 15, 2012 03:14
-
-
Save tommetge/2934482 to your computer and use it in GitHub Desktop.
Export users to CSV (Canvas)
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 urllib2 | |
res = urllib2.urlopen("https://canvas.instructure.com/api/v1/accounts/85240/users?access_token=**") | |
users = json.loads(res.read()) | |
csv = "" | |
for user in users: | |
attributes = flatten_dict_values(user) | |
i = 0 | |
for attribute in attributes: | |
i += 1 | |
csv += "%s" % attribute | |
if i < len(attributes): | |
csv += "," | |
csv += "\n" | |
print csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment