Skip to content

Commit

Permalink
remove web stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarreddypatil committed Jan 23, 2025
1 parent 0d12bc9 commit 0f5951d
Show file tree
Hide file tree
Showing 11 changed files with 227 additions and 226 deletions.
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@
# Gradescope to iCalendar Converter

Project forked from [apozharski/gradescope-api](https://github.com/apozharski/gradescope-api) because I didn't feel like writing a webcrawler.

## Usage

```bash
python -m venv venv # Create a virtual environment
chmod +x venv/bin/activate # Make the activate script executable
source venv/bin/activate # Activate the virtual environment
pip install -r requirements.txt # Install dependencies
python main.py # Run the script
```

You'll be prompted for your Gradescope username and password. After the script runs, there should be a file called `gradescope.ics` in the current directory.

## Flask App

There's also a Flask app that can be called like this:
`http://0.0.0.0:whatever/gradescope?email=<write email here>&pwd=<write password here>`
35 changes: 0 additions & 35 deletions app.py

This file was deleted.

7 changes: 0 additions & 7 deletions docker-compose.yml

This file was deleted.

38 changes: 0 additions & 38 deletions fly.toml

This file was deleted.

7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import dotenv
from threading import Thread
from pyscope import pyscope as gs
from ics import Calendar, Event
import datetime
from getpass import getpass
import os
import hashlib

from pyscope.account import GSAccount, GSCourse

dotenv.load_dotenv()


def login(email, pwd) -> GSAccount:
conn = gs.GSConnection()
Expand Down Expand Up @@ -107,9 +109,6 @@ def do_the_thing(email, pwd, sem=None):
thread = Thread(target=get_course_events, args=(course, events))
thread.start()
threads.append(thread)
# events = get_course_events(course)
# for event in events:
# cal.events.add(event)

for thread in threads:
thread.join()
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[project]
name = "gradescope-ics"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"beautifulsoup4>=4.12.3",
"ics>=0.7.2",
"python-dotenv>=1.0.1",
"requests>=2.32.3",
]
11 changes: 7 additions & 4 deletions pyscope/pyscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,20 @@ def get_account(self):

for course in student_courses.find_all("a", class_="courseBox"):
shortname = course.find("h3", class_="courseBox--shortname").text
name = course.find("h4", class_="courseBox--name").text
name = course.find("div", class_="courseBox--name").text
cid = course.get("href").split("/")[-1]

year = None
for tag in course.parent.previous_siblings:
if tag.get("class") == "courseList--term pageSubheading":
year = tag.body
if "courseList--term" in tag.get("class"):
year = tag.text
break
if year is None:
return False # Should probably raise an exception.
raise Exception("Could not find year for course")
self.account.add_class(cid, name, shortname, year)

return True


# THIS IS STRICTLY FOR DEVELOPMENT TESTING :( Sorry for leaving it in.
if __name__ == "__main__":
Expand Down
31 changes: 0 additions & 31 deletions requirements.txt

This file was deleted.

73 changes: 0 additions & 73 deletions templates/index.html

This file was deleted.

Loading

0 comments on commit 0f5951d

Please sign in to comment.