Unofficial calendar integration with Gradescope

Overview

Gradescope-Calendar

PyPi version

This script scrapes your Gradescope account for courses and assignment details. Assignment details currently can be transferred to iCalendar events (and then imported to other calendar applications such as Google Calendar). Another method exists to write these assignment details directly to a Google Calendar but requires additional setup. Scraping the Gradescope website is largely based off of the projects this is forked from.

Requirements

  • Python 3.6 or above

Installation

Windows

pip install gradescopecalendar

Mac/Linux

pip3 install gradescopecalendar

Development

Windows

git clone https://github.com/calvinatian/gradescope-calendar.git
cd gradescope-calendar
python -m venv .venv
.venv/Scripts/activate
pip install -r requirements.txt

Mac/Linux

git clone https://github.com/calvinatian/gradescope-calendar.git
cd gradescope-calendar
python3 -m venv .venv
.venv/Scripts/activate
pip3 install -r requirements.txt

Usage

Copy paste the below code or use the example script located at example.py. Modify the EMAIL and PASSWORD fields with your Gradescope account information then run the script.

from gradescopecalendar.gradescopecalendar import GradescopeCalendar
import logging

if __name__ == "__main__":
    # ------------------------------------------------------------ #
    # Modify these two fields with your Gradescope account details #
    EMAIL = ""
    PASSWORD = ""
    # Modify these for logging
    LOGGING_ENABLED = True
    LOGGING_LEVEL = logging.DEBUG
    # Valid logging levels
    # logging.INFO, logging.DEBUG, logging.WARN, logging.CRITICAL
    # ------------------------------------------------------------ #

    logger = logging.getLogger("gradescopecalendar" if LOGGING_ENABLED else __name__)
    logger.setLevel(logging.DEBUG)
    result = GradescopeCalendar(EMAIL, PASSWORD)
    result.write_to_ical()
    # Uncomment below to update Google Calendar directly
    # result.write_to_gcal()

Details about the application are written to the log file gradescopecalendar.log if enabled.

Advanced settings

Google Calendar

  1. Goto the Google Cloud Platform and create a new project.
  2. From the sidebar click "APIs & Services" and then "Dashboard".
  3. At the top of the page click "Enable API and Services".
  4. Scroll down to the Google Calendar API and enable it.
  5. Goto the sidebar and click on "OAuth consent screen".
  6. Click on "External".
  7. Fill in the App information. Since this API instance will only be used by yourself it does not really matter what you fill in.
  8. You can skip filling in the "Scopes" section. Just click "Save and Continue".
  9. On the "Test users" add the email(s) you want to modify the calendars for. If you are paranoid about the script altering your private calendar details you can create a new Google account and add that instead. Then you can share that calendar to other Google accounts.
  10. On the sidebar goto the "Credentials" tab and create a new "OAuth Client ID".
  11. Select Desktop app for Application type and give it any name.
  12. Once the ID has been created, click the "Download JSON" button and save the file to your computer as credentials.json and move it to where you are using gradescopecalendar.
  13. You can now uncomment the line for writing to Google Calendar and run the script.

Notes

  • On first run you will be prompted to login and grant access to your account for the project. This will create a token.json in the folder granting access to the script to modify your calendar. No one should be able to access your account if this file is kept secure. As mentioned earlier, you can also create a new Google account and use that calendar instead. Then you can share that calendar with your other Google accounts.
  • You might notice nothing being printed to the console when running the script. This is intentional. Enable logging and check the gradescopecalendar.log for details about the script progress.
  • The first run of writing to Google Calendar may take a while depending on how many assignments there are to create/modify. Subsequent runs should be much faster as only new or updated assignments will be created/modified.
  • Calendar events on the Gradescope calendar are never deleted, only created or updated. If the name of an assignment changes a new event will be created with the new name. Otherwise, if the start/end time or the location (URL of the assignment) of the event differ between Gradescope and Google Calendar, the event will be updated with the values from Gradescope. All other fields such as the description should remain unchanged.

Future Plans

  • More use options such as the naming format of the events and how much to offset the start time by (currently start time is the same as end time).
  • Ability to add custom reminders for Google Calendar events.
You might also like...
🔍 Google Search unofficial API for Python with no external dependencies

Python Google Search API Unofficial Google Search API for Python. It uses web scraping in the background and is compatible with both Python 2 and 3. W

Unofficial GoPro API Library for Python - connect to GoPro via WiFi.
Unofficial GoPro API Library for Python - connect to GoPro via WiFi.

GoPro API for Python Unofficial GoPro API Library for Python - connect to GoPro cameras via WiFi. Compatibility: HERO3 HERO3+ HERO4 (including HERO Se

Unofficial Python wrapper for official Hacker News API

haxor Unofficial Python wrapper for official Hacker News API. Installation pip install haxor Usage Import and initialization: from hackernews import H

Unofficial Medium Python Flask API and SDK
Unofficial Medium Python Flask API and SDK

PyMedium - Unofficial Medium API PyMedium is an unofficial Medium API written in python flask. It provides developers to access to user, post list and

(unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally free of charge.

Googletrans Googletrans is a free and unlimited python library that implemented Google Translate API. This uses the Google Translate Ajax API to make

An unofficial client library for Google Music.

gmusicapi: an unofficial API for Google Play Music gmusicapi allows control of Google Music with Python. from gmusicapi import Mobileclient api = Mob

Unofficial Python API client for Notion.so
Unofficial Python API client for Notion.so

notion-py Unofficial Python 3 client for Notion.so API v3. Object-oriented interface (mapping database tables to Python classes/attributes) Automatic

rewise is an unofficial wrapper for google search's auto-complete feature

rewise is an unofficial wrapper for google search's auto-complete feature

An Unofficial TikTok API Wrapper In Python

This is an unofficial api wrapper for TikTok.com in python. With this api you are able to call most trending and fetch specific user information as well as much more.

Comments
  • Research into reducing hard dependency on Python 3.9

    Research into reducing hard dependency on Python 3.9

    Right now the type hints restrict usage to Python 3.9 or above. Look into future importing for older versions or refactoring how type hints are handled.

    enhancement 
    opened by calvinatian 1
  • Improve logging

    Improve logging

    Some important events to log to ensure script is working: when all courses are loaded, when all assignments are loaded, when ics file is written, when adding/updating google calendar is done.

    Go through logging levels and determine where each statement is best suited.

    Add ability to automatically prune log after a certain age and/or size.

    enhancement 
    opened by calvinatian 0
  • Implement progress bar

    Implement progress bar

    Right now the console is empty while the script is running. It would be nice to have some indication progress is being made.

    https://github.com/tqdm/tqdm

    enhancement 
    opened by calvinatian 0
Owner
null
📅 Calendar file generator for triathlonlive.tv upcoming events

Triathlon Live Calendar Calendar file generator for triathlonlive.tv upcoming events. Install Requires Python 3.9.4 and Poetry. $ poetry install Runni

Eduardo Cuducos 4 Sep 2, 2022
Apps related to Odoo it's calendar features

calendar Apps related to Odoo it's calendar/appointments features: online_appointment_locations: allow setting an online URL per employee online_appoi

Yenthe Van Ginneken 3 Oct 27, 2022
A discord bot that utilizes Google's Rest API for Calendar, Drive, and Sheets

Bott This is a discord bot that utilizes Google's Rest API for Calendar, Drive, and Sheets. The bot first takes the sheet from the schedule manager in

null 1 Dec 4, 2021
Bezlik Year Calendar Planner

Bezlik Year Calendar Planner Scribus script for creating year planners on one page A1 paper format. Script is based on Year-Calendar-Script-for-Scribu

Bohdan Bobrowski 2 May 24, 2022
Takes upcoming items from a Google Calendar and posts them to Slack.

Google Calendar to Slack by Jason Snell - [email protected] This Python script scrapes upcoming items from Google Calendar HTML and posts them to S

null 6 Aug 21, 2022
PyHoroscope - Observational Indian lunisolar calendar, horoscope and matching using the Swiss ephemeris

PyHoroscope Observational Indian lunisolar calendar, horoscope and matching usin

null 4 Jun 5, 2022
SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather

SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather, the c

John Calhoun 372 Jan 2, 2023
The unofficial Amazon search CLI & Python API

amzSear The unofficial Amazon Product CLI & API. Easily search the amazon product directory from the command line without the need for an Amazon API k

Asher Silvers 95 Nov 11, 2022
Unofficial Coinbase Python Library

Unofficial Coinbase Python Library Python Library for the Coinbase API for use with three legged oAuth2 and classic API key usage Version 0.3.0 Requir

George Sibble 104 Dec 1, 2022
An unofficial client library for Google Music.

gmusicapi: an unofficial API for Google Play Music gmusicapi allows control of Google Music with Python. from gmusicapi import Mobileclient api = Mob

Simon Weber 2.5k Dec 15, 2022