All Projects → ucfopen → Canvasapi

ucfopen / Canvasapi

Licence: mit
Python API wrapper for Instructure's Canvas LMS. Easily manage courses, users, gradebooks, and more.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Canvasapi

Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (-60.46%)
Mutual labels:  api, wrapper, hacktoberfest
Udoit
The Universal Design Online content Inspection Tool, or UDOIT (pronounced, “You Do It”) enables faculty to identify accessibility issues in Canvas by Instructure. It will scan a course, generate a report, and provide resources on how to address common accessibility issues.
Stars: ✭ 80 (-73.86%)
Mutual labels:  hacktoberfest, education, canvas
Minha Receita
🏢 Sua API web para consulta de informações do CNPJ da Receita Federal
Stars: ✭ 255 (-16.67%)
Mutual labels:  api, hacktoberfest
Laravel Query Builder
Easily build Eloquent queries from API requests
Stars: ✭ 3,083 (+907.52%)
Mutual labels:  api, hacktoberfest
Wp Graphql
🚀 GraphQL API for WordPress
Stars: ✭ 3,097 (+912.09%)
Mutual labels:  api, hacktoberfest
Horaires Ratp Api
Webservice pour les horaires et trafic RATP en temps réel
Stars: ✭ 232 (-24.18%)
Mutual labels:  api, hacktoberfest
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+1026.8%)
Mutual labels:  api, hacktoberfest
Common
A set of common utils for consuming Web APIs with Angular
Stars: ✭ 259 (-15.36%)
Mutual labels:  api, hacktoberfest
Chartbrew
Open-source web platform for creating charts out of different data sources (databases and APIs) 📈📊
Stars: ✭ 199 (-34.97%)
Mutual labels:  api, hacktoberfest
Pycoingecko
Python wrapper for the CoinGecko API
Stars: ✭ 270 (-11.76%)
Mutual labels:  api, wrapper
Twitchio
TwitchIO - An Async Bot/API wrapper for Twitch made in Python.
Stars: ✭ 268 (-12.42%)
Mutual labels:  api, wrapper
Free Courses
A collection of free courses about programming 📖
Stars: ✭ 281 (-8.17%)
Mutual labels:  hacktoberfest, education
Zenpy
Python wrapper for the Zendesk API
Stars: ✭ 222 (-27.45%)
Mutual labels:  api, wrapper
Api struct
API wrapper builder with response serialization
Stars: ✭ 224 (-26.8%)
Mutual labels:  api, wrapper
Abibliadigital
A RESTful API for Bible
Stars: ✭ 251 (-17.97%)
Mutual labels:  api, hacktoberfest
Bookmarks.dev
Bookmarks and Code Snippets Manager for Developers & Co
Stars: ✭ 218 (-28.76%)
Mutual labels:  api, hacktoberfest
Canvg
Javascript SVG parser and renderer on Canvas
Stars: ✭ 2,963 (+868.3%)
Mutual labels:  hacktoberfest, canvas
Vulcain
Fast and idiomatic client-driven REST APIs.
Stars: ✭ 3,190 (+942.48%)
Mutual labels:  api, hacktoberfest
Pokeapi
The Pokémon API
Stars: ✭ 2,695 (+780.72%)
Mutual labels:  api, hacktoberfest
Symfony Flex Backend
Symfony Flex REST API template project
Stars: ✭ 214 (-30.07%)
Mutual labels:  api, hacktoberfest

CanvasAPI on PyPI License Python Versions Documentation Status Build Status Coverage Status Join UCF Open Slack Discussions Code style: black

CanvasAPI

CanvasAPI is a Python library for accessing Instructure’s Canvas LMS API. The library enables developers to programmatically manage Canvas courses, users, gradebooks, and more.

Table of Contents

Installation

You can install CanvasAPI with pip:

pip install canvasapi

Documentation

Full documentation is available at Read the Docs.

Contributing

Want to help us improve CanvasAPI? Check out our Contributing Guide to learn about running CanvasAPI as a developer, picking issues to work on, submitting bug reports, contributing patches, and more.

Quickstart

Getting started with CanvasAPI is easy.

Like most API clients, CanvasAPI exposes a single class that provides access to the rest of the API: Canvas.

The first thing to do is instantiate a new Canvas object by providing your Canvas instance’s root API URL and a valid API key:

# Import the Canvas class
from canvasapi import Canvas

# Canvas API URL
API_URL = "https://example.com"
# Canvas API key
API_KEY = "[email protected]$$w0rd"

# Initialize a new Canvas object
canvas = Canvas(API_URL, API_KEY)

You can now use canvas to begin making API calls.

Working with Canvas Objects

CanvasAPI converts the JSON responses from the Canvas API into Python objects. These objects provide further access to the Canvas API. You can find a full breakdown of the methods these classes provide in our class documentation. Below, you’ll find a few examples of common CanvasAPI use cases.

Course objects

Courses can be retrieved from the API:

# Grab course 123456
>>> course = canvas.get_course(123456)

# Access the course's name
>>> course.name
'Test Course'

# Update the course's name
>>> course.update(course={'name': 'New Course Name'})

See our documentation on keyword arguments for more information about how course.update() handles the name argument.

User objects

Individual users can be pulled from the API as well:

# Grab user 123
>>> user = canvas.get_user(123)

# Access the user's name
>>> user.name
'Test User'

# Retrieve a list of courses the user is enrolled in
>>> courses = user.get_courses()

# Grab a different user by their SIS ID
>>> login_id_user = canvas.get_user('some_user', 'sis_login_id')

Paginated Lists

Some calls, like the user.get_courses() call above, will request multiple objects from Canvas’s API. CanvasAPI collects these objects in a PaginatedList object. PaginatedList generally acts like a regular Python list. You can grab an element by index, iterate over it, and take a slice of it.

Warning: PaginatedList lazily loads its elements. Unfortunately, there’s no way to determine the exact number of records Canvas will return without traversing the list fully. This means that PaginatedList isn’t aware of its own length and negative indexing is not currently supported.

Let’s look at how we can use the PaginatedList returned by our get_courses() call:

# Retrieve a list of courses the user is enrolled in
>>> courses = user.get_courses()

>>> print(courses)
<PaginatedList of type Course>

# Access the first element in our list.
#
# You'll notice the first call takes a moment, but the next N-1
# elements (where N = the per_page argument supplied; the default is 10)
# will be instantly accessible.
>>> print(courses[0])
TST101 Test Course (1234567)

# Iterate over our course list
>>> for course in courses:
         print(course)

TST101 Test Course 1 (1234567)
TST102 Test Course 2 (1234568)
TST103 Test Course 3 (1234569)

# Take a slice of our course list
>>> courses[:2]
[TST101 Test Course 1 (1234567), TST102 Test Course 2 (1234568)]

Keyword arguments

Most of Canvas’s API endpoints accept a variety of arguments. CanvasAPI allows developers to insert keyword arguments when making calls to endpoints that accept arguments.

# Get all of the active courses a user is currently enrolled in
>>> courses = user.get_courses(enrollment_state='active')

For a more detailed description of how CanvasAPI handles more complex keyword arguments, check out the Keyword Argument Documentation.

CanvasAPI Projects

Since its initial release in June 2016, CanvasAPI has amassed over 100 dependent repositories. Many of these include various tools used to enhance the Canvas experience for both instructors and students. Here are a few popular repositories that use CanvasAPI:

  • Canvas Grab
    • Canvas Grab is the most popular project using CanvasAPI. This tool, with one click, copies all files from Canvas LMS to local directory. CanvasAPI is used in this project to connect to a course and grab its files.
  • Clanvas
    • Clanvas is a command-line client for Canvas. It uses the already available bash commands plus some additional ones to interact with various features of Canvas from the commmand line.
  • CS221Bot
    • CS221Bot is a Discord bot for the CPCS 221 course at University of British Columbia. CanvasAPI is used in this project to connect to and synchronize with a course and get its data, such as announcements, new assignments, and more.

If you have a project that uses CanvasAPI that you'd like to promote, please contact us!

Contact Us

Need help? Have an idea? Feel free to check out our Discussions board. Just want to say hi or get extended spport? Come join us on the UCF Open Slack Channel and join the #canvasapi channel!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].