You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy the code below into a file called example.py (or whatever you want to call it)
Replace the values for course_id, oauth_token, and canvas_url with your real values.
fromcanvas_sdk.methodsimportsectionsfromcanvas_sdkimportRequestContextcourse_id=12345# needs to be replace with real valueoauth_token='secret_token'# needs to be replace with real valuecanvas_url='https://hostname/api'# needs to be replace with real value# init the request contextrequest_context=RequestContext(oauth_token, canvas_url)
results=sections.list_course_sections(request_context, course_id)
foridx, sectioninenumerate(results.json()):
print"section %d has data %s"% (idx, section)