Skip to content

Commit 086357b

Browse files
authored
Merge pull request #112 from Zohair-coder/dev
Dev
2 parents d8c996d + 01b7664 commit 086357b

File tree

11 files changed

+1396
-235
lines changed

11 files changed

+1396
-235
lines changed

.github/workflows/functional_test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
uses: docker/setup-buildx-action@v3
3535

3636
- name: Start PostgreSQL
37-
run: docker-compose up -d postgres
37+
run: docker compose up -d postgres
3838

3939
- name: Wait for PostgreSQL to become ready
4040
run: |
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: Run the scraper
5050
env:
51-
DREXEL_USERNAME: ${{ secrets.DREXEL_USERNAME }}
51+
DREXEL_EMAIL: ${{ secrets.DREXEL_EMAIL }}
5252
DREXEL_PASSWORD: ${{ secrets.DREXEL_PASSWORD }}
5353
DREXEL_MFA_SECRET_KEY: ${{ secrets.DREXEL_MFA_SECRET_KEY }}
5454
run: docker compose run scraper python3 src/main.py --db --all-colleges --ratings
@@ -104,11 +104,11 @@ jobs:
104104
fi
105105
106106
- name: Reset database
107-
run: docker compose run scraper sh -c 'apk add postgresql-client && ./scripts/reset-db.sh;'
107+
run: docker compose run scraper sh -c 'apt-get install -y postgresql-client && ./scripts/reset-db.sh;'
108108

109109
- name: Run scraper again (to test cache)
110110
env:
111-
DREXEL_USERNAME: ${{ secrets.DREXEL_USERNAME }}
111+
DREXEL_EMAIL: ${{ secrets.DREXEL_EMAIL }}
112112
DREXEL_PASSWORD: ${{ secrets.DREXEL_PASSWORD }}
113113
DREXEL_MFA_SECRET_KEY: ${{ secrets.DREXEL_MFA_SECRET_KEY }}
114114
run: docker compose run scraper python3 src/main.py --db --all-colleges --ratings
@@ -164,4 +164,4 @@ jobs:
164164
fi
165165
166166
- name: Cleanup
167-
run: docker-compose down -v
167+
run: docker compose down -v

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
FROM python:3.12-alpine
1+
FROM python:3.12
22

33
# set the working directory in the container
44
WORKDIR /app
55

66
# copy the current directory contents into the container at /app
77
COPY . /app
88

9-
# upgrade pip
10-
RUN pip install --upgrade pip
11-
129
# install dependencies
13-
RUN pip install -r requirements.txt
10+
RUN pip install --upgrade pip && \
11+
pip install -r requirements.txt && \
12+
playwright install chromium --with-deps
1413

1514
# Run the Python script
1615
CMD ["python3", "src/main.py", "--db", "--all-colleges", "--ratings", "--email"]

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ Make sure you have [Python 3](https://www.python.org/downloads/) installed. Then
1818
###### Mac/Linux
1919
```bash
2020
pip3 install -r requirements.txt
21+
playwright install
2122
```
2223

2324
###### Windows
2425
```bash
2526
pip install -r requirements.txt
27+
playwright install
2628
```
2729

2830
## Usage
@@ -44,17 +46,21 @@ The scraper will output a JSON file called `data.json` in the same directory as
4446

4547
You can modify the scraper to scrape other terms by changing the `year`, `quarter`, and `college_code` variables in `src/config.py`.
4648

49+
To view all the options that the scraper supports, run `python3 src/main.py --help` on Mac/Linux, or `python src/main.py --help` on Windows.
50+
4751
#### Authentication
4852

4953
Since the term master schedule is only accessible to logged-in Drexel students, to run the scraper, you will need to provide your Drexel credentials as well as provide multi-factor authentication (MFA).
5054

51-
To provide your Drexel credentials, set the environment variable `DREXEL_USERNAME` to your Drexel username (abc123) and `DREXEL_PASSWORD` to the password you use to login to Drexel One. You can follow [this](https://phoenixnap.com/kb/windows-set-environment-variable) guide for Windows, and [this](https://phoenixnap.com/kb/set-environment-variable-mac) guide for MacOS to set environment variables.
55+
To provide your Drexel credentials, set the environment variable `DREXEL_EMAIL` to your Drexel email ([email protected]) and `DREXEL_PASSWORD` to the password you use to login to Drexel One. You can follow [this](https://phoenixnap.com/kb/windows-set-environment-variable) guide for Windows, and [this](https://phoenixnap.com/kb/set-environment-variable-mac) guide for MacOS to set environment variables.
56+
57+
You will also need to go to [this page](https://mysignins.microsoft.com/security-info) and make sure "Authenticator app or hardware token" is the preferred sign-in method. Unfortunately, if you use Microsoft Authenticator as your MFA app you will not be able to run the scraper. You will have to delete the Microsoft Authenticator sign in method and install a different MFA app.
5258

5359
There are two ways to provide MFA for the script to authenticate with. The first is easier if you're looking to run the script manually and quickly. The second is better if you are going to be running the script frequently, or if it needs to be automated.
5460

5561
###### Authenticate manually
5662

57-
You will authenticate the scraper manually as if you were logging into Drexel One, using a one-time code either from an authenticator app or that is texted to you. After setting the `DREXEL_USERNAME` and `DREXEL_PASSWORD` environment variables, run the scraper as explained [above](#Usage), and you will be prompted for your verification code.
63+
You will authenticate the scraper manually as if you were logging into Drexel One, using a one-time code either from an authenticator app or that is texted to you. After setting the `DREXEL_EMAIL` and `DREXEL_PASSWORD` environment variables, run the scraper as explained [above](#Usage), and you will be prompted for your verification code.
5864

5965
###### Authenticate using a secret key
6066

0 commit comments

Comments
 (0)