This is just a quick hack of the original to produce only a single HTML file with all replies in that one file It's just a quick hack - set your file name before running on line 65 Also adds in names for all subsequent entries
Script that will convert discussion posts from Canvas LMS and save them to files. Canvas allows you to download all submissions to assignments, but there is no way to do the same thing with discussion posts. However, the data is available in JSON format, it just needs parsed into readable files. This script will parse the data and save it into individual HTML files for each student. The format of the HTML files is the same as the format of the HTML files from downloaded assignment submissions.
Unfortunately, Canvas requires Bearer authentication to get access to the data, which is a pain to do through the API and you have to go through institutional access. So this Python script cannot get the data directly from the Canvas website, you have to download it into a text file first.
The script can be run 2 ways - with 2 different types of inputs:
- Give it 3 arguments: an institution name, course ID, and discussion ID. If the script detects these inputs, it will report the web address to use to get your discussion posts. Copy and paste this address into a browser and save the results as a file.
- Once you have the posts saved as a file, run this script with a filename as the argument and it will process the file and save the posts into individual HTML files.