# Gradescope-Calendar
[![PyPi version](https://badgen.net/pypi/v/gradescopecalendar/)](https://pypi.org/project/gradescopecalendar/)
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.
- [Gradescope-Calendar](#gradescope-calendar)
- [Requirements](#requirements)
- [Installation](#installation)
- [Upgrade](#upgrade)
- [Development](#development)
- [Usage](#usage)
- [Automatically running](#automatically-running)
- [Windows](#windows)
- [Linux](#linux)
- [Mac](#mac)
- [Advanced settings](#advanced-settings)
- [Google Calendar](#google-calendar)
- [Notes](#notes)
- [Future Plans](#future-plans)
## Requirements
* Python 3.7 or above
## Installation
Windows
```bash
python -m venv .venv
.venv/Scripts/activate
pip install gradescopecalendar
```
Mac/Linux
```bash
python3 -m venv venv
source venv/bin/activate
pip3 install gradescopecalendar
```
### Upgrade
Windows
```bash
pip install --upgrade gradescopecalendar
```
Mac/Linux
```bash
pip3 install --upgrade gradescopecalendar
```
### Development
These steps are only necessary if you wish to install or work on the development version.
Windows
```bash
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
```bash
git clone https://github.com/calvinatian/gradescope-calendar.git
cd gradescope-calendar
python3 -m venv venv
source venv/bin/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.
```py
from gradescopecalendar.gradescopecalendar import GradescopeCalendar
import logging
if __name__ == "__main__":
# ------------------------------------------------------------ #
# Modify these two fields with your Gradescope account details #
EMAIL = ""
PASSWORD = ""
IS_INSTRUCTOR = False # If you are an instructor for **any** course,
# modify this to True.
# 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 None)
logger.setLevel(LOGGING_LEVEL)
calendar = GradescopeCalendar(EMAIL, PASSWORD, IS_INSTRUCTOR)
calendar.write_to_ical()
# Uncomment below to update Google Calendar directly
# calendar.write_to_gcal()
```
Details about the application are written to the log file `gradescopecalendar.log` if enabled.
### Automatically running
#### Windows
Windows task scheduler
#### Linux
Cron
#### Mac
Launchd
## Advanced settings
### Google Calendar
1. Goto the [Google Cloud Platform](https://console.cloud.google.com) 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/calvinatian/gradescope-calendar",
"name": "gradescopecalendar",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Calvin",
"author_email": "calvinaatian@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/18/7f/25572b2d37cc59145ec617f6d32ce4f2ee04b1ead5c9b90ca1412aaef9d8/gradescopecalendar-0.0.9.tar.gz",
"platform": null,
"description": "# Gradescope-Calendar\r\n\r\n[![PyPi version](https://badgen.net/pypi/v/gradescopecalendar/)](https://pypi.org/project/gradescopecalendar/)\r\n\r\nThis 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.\r\n\r\n- [Gradescope-Calendar](#gradescope-calendar)\r\n - [Requirements](#requirements)\r\n - [Installation](#installation)\r\n - [Upgrade](#upgrade)\r\n - [Development](#development)\r\n - [Usage](#usage)\r\n - [Automatically running](#automatically-running)\r\n - [Windows](#windows)\r\n - [Linux](#linux)\r\n - [Mac](#mac)\r\n - [Advanced settings](#advanced-settings)\r\n - [Google Calendar](#google-calendar)\r\n - [Notes](#notes)\r\n - [Future Plans](#future-plans)\r\n\r\n## Requirements\r\n\r\n* Python 3.7 or above\r\n\r\n## Installation\r\n\r\nWindows\r\n\r\n```bash\r\npython -m venv .venv\r\n.venv/Scripts/activate\r\npip install gradescopecalendar\r\n```\r\n\r\nMac/Linux\r\n\r\n```bash\r\npython3 -m venv venv\r\nsource venv/bin/activate\r\npip3 install gradescopecalendar\r\n```\r\n\r\n### Upgrade\r\n\r\nWindows\r\n\r\n```bash\r\npip install --upgrade gradescopecalendar\r\n```\r\n\r\nMac/Linux\r\n\r\n```bash\r\npip3 install --upgrade gradescopecalendar\r\n```\r\n\r\n\r\n### Development\r\n\r\nThese steps are only necessary if you wish to install or work on the development version.\r\n\r\nWindows\r\n\r\n```bash\r\ngit clone https://github.com/calvinatian/gradescope-calendar.git\r\ncd gradescope-calendar\r\npython -m venv .venv\r\n.venv/Scripts/activate\r\npip install -r requirements.txt\r\n```\r\n\r\nMac/Linux\r\n\r\n```bash\r\ngit clone https://github.com/calvinatian/gradescope-calendar.git\r\ncd gradescope-calendar\r\npython3 -m venv venv\r\nsource venv/bin/activate\r\npip3 install -r requirements.txt\r\n```\r\n\r\n## Usage\r\n\r\nCopy 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.\r\n\r\n```py\r\nfrom gradescopecalendar.gradescopecalendar import GradescopeCalendar\r\nimport logging\r\n\r\nif __name__ == \"__main__\":\r\n # ------------------------------------------------------------ #\r\n # Modify these two fields with your Gradescope account details #\r\n EMAIL = \"\"\r\n PASSWORD = \"\"\r\n IS_INSTRUCTOR = False # If you are an instructor for **any** course,\r\n # modify this to True.\r\n # Modify these for logging\r\n LOGGING_ENABLED = True\r\n LOGGING_LEVEL = logging.DEBUG\r\n # Valid logging levels\r\n # logging.INFO, logging.DEBUG, logging.WARN, logging.CRITICAL\r\n # ------------------------------------------------------------ #\r\n\r\n logger = logging.getLogger(\"gradescopecalendar\" if LOGGING_ENABLED else None)\r\n logger.setLevel(LOGGING_LEVEL)\r\n calendar = GradescopeCalendar(EMAIL, PASSWORD, IS_INSTRUCTOR)\r\n calendar.write_to_ical()\r\n # Uncomment below to update Google Calendar directly\r\n # calendar.write_to_gcal()\r\n```\r\n\r\nDetails about the application are written to the log file `gradescopecalendar.log` if enabled.\r\n\r\n### Automatically running\r\n\r\n#### Windows\r\n\r\nWindows task scheduler\r\n\r\n#### Linux\r\n\r\nCron\r\n\r\n#### Mac\r\n\r\nLaunchd\r\n\r\n## Advanced settings\r\n\r\n### Google Calendar\r\n\r\n1. Goto the [Google Cloud Platform](https://console.cloud.google.com) and create a new project.\r\n2. From the sidebar click \"APIs & Services\" and then \"Dashboard\".\r\n3. At the top of the page click \"Enable API and Services\".\r\n4. Scroll down to the Google Calendar API and enable it.\r\n5. Goto the sidebar and click on \"OAuth consent screen\".\r\n6. Click on \"External\".\r\n7. Fill in the App information. Since this API instance will only be used by yourself it does not really matter what you fill in.\r\n8. You can skip filling in the \"Scopes\" section. Just click \"Save and Continue\".\r\n9. 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.\r\n10. On the sidebar goto the \"Credentials\" tab and create a new \"OAuth Client ID\".\r\n11. Select Desktop app for Application type and give it any name.\r\n12. 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`.\r\n13. You can now uncomment the line for writing to Google Calendar and run the script.\r\n\r\n#### Notes\r\n\r\n* 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.\r\n* 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.\r\n* 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.\r\n* 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.\r\n\r\n### Future Plans\r\n\r\n* 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).\r\n* Ability to add custom reminders for Google Calendar events.\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Unofficial calendar integration for Gradescope",
"version": "0.0.9",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b4e1ebb197c0c4c52be8d48e38a7f5fe490d2ed7b5ad329e25ab68056925b85a",
"md5": "7253576b627cd2271fc2d3b556f48a20",
"sha256": "529d4a9d453350a7e53933ac163722e406e1ffde5aad7a4960bb33d7d0cb39fe"
},
"downloads": -1,
"filename": "gradescopecalendar-0.0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7253576b627cd2271fc2d3b556f48a20",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 26175,
"upload_time": "2023-02-11T01:48:08",
"upload_time_iso_8601": "2023-02-11T01:48:08.293779Z",
"url": "https://files.pythonhosted.org/packages/b4/e1/ebb197c0c4c52be8d48e38a7f5fe490d2ed7b5ad329e25ab68056925b85a/gradescopecalendar-0.0.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "187f25572b2d37cc59145ec617f6d32ce4f2ee04b1ead5c9b90ca1412aaef9d8",
"md5": "704655d48e4a995ea3d5f581a510511c",
"sha256": "4133a0485767a1d7932edae6cf66ec3252edb6e6e47dfe4fb093644b75b0847f"
},
"downloads": -1,
"filename": "gradescopecalendar-0.0.9.tar.gz",
"has_sig": false,
"md5_digest": "704655d48e4a995ea3d5f581a510511c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 26000,
"upload_time": "2023-02-11T01:48:12",
"upload_time_iso_8601": "2023-02-11T01:48:12.914382Z",
"url": "https://files.pythonhosted.org/packages/18/7f/25572b2d37cc59145ec617f6d32ce4f2ee04b1ead5c9b90ca1412aaef9d8/gradescopecalendar-0.0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-11 01:48:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "calvinatian",
"github_project": "gradescope-calendar",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "gradescopecalendar"
}