Daniel Grobani

Unwrapping Yet Another Python Canvas API Wrapper—and More

Blog Post created by Daniel Grobani on Jul 17, 2017

For the last several years I’ve been developing a library of Python code that makes my life as Samuel Merritt University’s Canvas admin easier and enables me to turn institutional ideas into reality. Though I’ve always intended to share this code with the Canvas Community in case someone else might find it helpful, it's always been a work in progress, and it’s been all-too-easy to fall into believing it’s not complete enough, not polished enough, not professional enough, not documented enough....


But now, in a mighty effort to stop letting the perfect being the enemy of the good, I’m sharing it just as it is, with these few words of introduction.


I began developing this library in response to an institutional need to import learning outcomes into Canvas courses from CMI, our homebrew, stand-alone assessment tool. I accomplished that through the use of Python, the Requests module, and the Canvas API documentation, as well as PyCharm, the Python IDE I can’t say enough good things about! (Python coders in academic institutions can get a free academic license).


Over time, the library of API call wrappers and utility functions has grown in the process of writing scripts to automate new tasks. Among the tasks I’ve automated using this library are:


  • Sync subaccount-level learning outcomes with outcomes in an external repository.
  • Sync course-level learning outcomes with subaccount-level outcomes.
  • Import outcomes into a course from a formatted Word document.
  • Generate a syllabus for a course by wrangling data from Canvas, our SIS, and CMI into a Word template.
  • Download all syllabus files from courses.
  • List assignments that use the Turnitin API.
  • Retrieve an SIS report.
  • Do an SIS import of enrollments by uploading a CSV file created by running a SQL file against the SIS.
  • Assist in assessing Canvas course design best practices by generating an inventory of specific Canvas features that courses use.
  • Find and replace text in Canvas pages.
  • List all cross-listed courses.
  • List admins at the account and subaccount level.


You can find the code for the core API functions, the utility functions, and the scripts that use them at my GitHub repository. I welcome any and all questions about the code or how to use it, and I’d be supremely grateful to receive recommendations for improving it.


Many thanks to Colin Murtaugh, Tobias Murray, and James Jones--sharing your work has inspired me to share mine.