Skip to content

Instantly share code, notes, and snippets.

@tommetge
Created June 15, 2012 03:14
Show Gist options
  • Save tommetge/2934482 to your computer and use it in GitHub Desktop.
Save tommetge/2934482 to your computer and use it in GitHub Desktop.
Export users to CSV (Canvas)
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