Coder Social home page Coder Social logo

fizza-rubab / canvas-developer Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 163 KB

This repository contains python script and docs that automate the process of generating course files for Habib University Courses using Canvas LMS API and site

Python 99.29% TeX 0.71%

canvas-developer's Introduction

Canvas Development - Generating Course Files

This tool downloads material from your Canvas course site. Specifically, it looks in the 'Assignments', 'Quizzes', and 'Disussions' sections of the course site.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for generating the course files.

Prerequisites

Functional requirements include Python 3.x and pip (Python package manager) as well as Google Chrome (any recent version) installed on your machine before hand.

These are the python packages you would need before running the script.

  • canvasapi
  • webdriver-manager
  • selenium
  • selenium-wire

Download these modules by running one of the following commands on the command line depending on your platform.

Windows: pip install <package-name>

*nix: pip3 install <package-name>

Retrieving the Access Token:

To run the python file coursefiles.py and generate course files, a canvas access token is required.

  1. In Canvas, go to Account (top left) -> Settings.
  2. On the Settings page, click on "+ New Access Token" button under the "Approved Integrations" section.
  3. Enter the Purpose, "Automatic Course File", and leave the expiry date blank. Click on "Generate Token".
  4. A token appears as a long string of characters in the next window. Copy it and paste it to a text editor. This has to be given to the program as an input.

Additional Material

The tool can download certain folders from the Files section of the site if they are named as follows.

  1. "syllabus.pdf": this file, if found, gets copied to the "Course Syllabus" sub-directory in the output folder
  2. "Slides/": the contents of this folder, if found, are copied to the "Lecture Notes" sub-directory in the output folder
  3. "Assignments/": the contents of this folder, if found, are copied to the "Assessments and Sample solutions/Assignment Copies/" sub-directory in the output folder
  4. "Assignment Solutions/": the contents of this folder, if found, are copied to the "Assessments and Sample solutions/Model Assignment Solutions/" sub-directory in the output folder

Running the file

Before running the program, ensure that you have a strong and stable Internet connection. Run the coursefiles.py python file from the command line as follows depending on your platform.

Windows: python coursefiles.py

*nix: python3 coursefiles.py

You will then be asked for certain inputs:

  1. Your access token: This is the token that you generated above. Please copy it here from your text editor where you had pasted it.
  2. Your course url: This is the URL of the Canvas site of the course whose course file you want to generate. It is of the form: https://hulms.instructure.com/courses/. You can copy-paste it from your browser.

A new Google Chrome window will now open and you will be redirected to the the Habib University's main LMS page. Please log in here to initiate the download process.

AS the program runs, various pages will automatically load and get downloaded in this Google Chrome window. You can safely ignore the winow, but take care to NOT close it yet. The console from where you ran the command will show the progress. The download takes some time and the Google Chrome window closes automatically once the download is complete. You can now find the "coursefiles" folder of the same name as your course in the working directory.

Important Instructions

  1. Do not close the browser window during execution. It might come to the foreground repeatedly due to page reloads. If som dock it to the background.
  2. The tool only works for an ongoing course.

Error Instructions

Any error during the download process can be identified through the following:

  1. The console gives some error message instead of the usual progress logs.
  2. The browser window becomes idle for a very long time. This error will be reflected in the console.
  3. The produced folder has missing items.
  4. The pdfs are generated incorrectly.

Kindly take a screenshot of the console error message on the console, a screenshot of the browser window and a breif error description and mail it to [email protected].

Code

The entire code is available in the file coursefiles.py which you have to run. You can find the latest version online at: https://github.com/Fizza-Rubab/Canvas-Developer . Contributions are welcome!

canvas-developer's People

Contributors

fizza-rubab avatar waqarsaleem avatar

Watchers

 avatar  avatar

Forkers

jazzel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.