This Python script uses the Canvas API to send all assignments for your current active semester into a Notion Database.
First, clone this repository:
$ git clone https://github.com/nathanatkinson22/canvas-to-notion-python.git $ cd canvas-to-notion-python
Install the dependencies:
$ pip install -r requirements.txt
You will need a Canvas API access token, which you can get by following these instructions
You'll also need a Notion API token, which you can learn about here. And you'll need to either duplicate this Notion database (open link, click Duplicate in the top left) create a Notion database set up with the following properties (property names are very important or the script won't work)
- Checkbox Property: Completed
- Title Property: Assignment Name
- Date Property: Due Date
- URL Property: Assignment Link
- Text Property: ID
- Text Property: Submission Type
After you create the database in Notion, copy the Database ID and add dashes in this pattern: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Share your Notion database with your new integration in Notion
Create a "constants.py" file in the same folder as the canvas_to_notion.py file and add the following to that file:
API_URL = "Your school's Canvas URL (e.g., https://yourschool.instructure.com" CANVAS_TOKEN = "Your Canvas API access token" NOTION_TOKEN = "Your Notion API access token" NOTION_DB_ID = "Your Notion Database ID"
Run the script and if you set up everything correctly, your database should be populated with all your Canvas assignments for the active semester with titles, links, and due dates.