Pull information through CanvasAPI

Jump to solution
Community Novice

So I am assisting a Professor to develop his own personal educational site outside of Canvas.  The Professor I am working with wishes to pull information off of Canvas and display it in the off-site display.  He is wanting to pull general information like the class list and course number, student list, and his students grades.  Is it possible to pull this information from Canvas and push it to his site?

I have read and researched different forums about using Python and the git repository of canvasapi, but I am still deeply confused on how/what I am doing.  Any information would help!

1 Solution
Community Explorer

Hey  @hjs653 ‌,

I'm one of the lead developers on the CanvasAPI library. It's definitely possible to grab all the information you want with CanvasAPI!

Something like this should be a good starting point:

from canvasapi import Canvas

API_URL = "" # institution base url (e.g. "https://example.instructure.com")
API_KEY = "" # access token

USER_ID = 1 # canvas ID of the user to get course information for

canvas = Canvas(API_URL, API_KEY)

user = canvas.get_user(USER_ID)

courses = user.get_courses()

for course in courses:
print("{} - {} ({})".format(course.course_code, course.name, course.id))
student_enrollments = course.get_enrollments(
for enrollment in student_enrollments:
print("\t{} {} {}".format(

Hopefully that gives you some ideas!

The best place to get help with CanvasAPI is to join UCF Open Source on Slack and join the #canvasapi channel. There's lots of friendly folks there willing to help you out! You could also create an issue on our GitHub.

Happy coding,
- Matt Emond

View solution in original post