Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
prepare for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Alice Fernandes committed Jul 7, 2023
1 parent 3f7a753 commit b02bf7e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
1 change: 1 addition & 0 deletions assets/sample-email.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sample email
Binary file added aulas_codigo.xlsx
Binary file not shown.
2 changes: 0 additions & 2 deletions modules/database.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pysqlcipher3 import dbapi2 as sqlite3
from dotenv import dotenv_values

# TODO: Marcar as restantes aulas por dia

config = dotenv_values("./.env")

aulas_dependencias = {
Expand Down
2 changes: 1 addition & 1 deletion modules/scrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def download_pdf():
"upgrade-insecure-requests": "1"
}


success = False
url = config["HORARIO_PDF"]
print("Reading from ", url)
Expand Down
37 changes: 27 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
# What is this?

pip3 install -r requirements.txt
# SQL Version
brew install sqlcipher
During COVID i started to take my drivers license, and in Portugal, for you to be able to do the road test, you need to first have 16 theory classes before you can go start to take practice lessons on a car. For those theory classes, during covid, you could only book them by sending an email to the drivers school or by calling. I work full time, so by the time i was able to check the theory classes schedule, some classes were already fully booked by other students.

# DB
Either SQLite or a Google Sheets
So, my solution was to develop a bot, that ran inside a Raspberry Pi 3, that did the scheduling for me, by email. Now that i was able to complete my driving license program, i now feel safe to share this little hacky cool project.

## How did this worked?

# docker
docker build -t drivesafe .
docker run -d --name drivesafe drivesafe
My driving school publishes a PDF with the schedule for the month, and i know what classes i have missing, and i also have an email account. So the steps are:

# todo
Notificações
1. Download the PDF from the website
2. Parse the PDF (with `tabula`) into data that can be worked with
3. Find all classes that are happening at a given hour for the month (with `pandas`)
4. Of all of the classes above, find the ones that i still need to take
1. My school had a restriction where i could only book 3 per month during COVID
5. Send a beautiful email to the school to book those classes (with `smtplib`)
6. After the email mark those classes as booked internally, and i used Google Sheets and `gspread` because i could see the spreadsheet on my phone, but also tried a SQLite database
7. Job done, i can now not worry too much about booking classes

I eventually ran this inside docker because my RasPi had a lot of cool stuff running, and it was great to stop code from messing with other code

## Did this worked?

Yes! I only finished this a little bit before finishing the theory classes, so it didn't had much use, but it did send some emails

### Config keys

This project needs some configurations that are kept out for safety, so take a look at the sample-env to see what keys i'm talking about

### Spreadsheet

I've put a spreadsheet that has the format that was used on this project. The data is gone, but it was that template, and it was online, on Google Sheets
15 changes: 15 additions & 0 deletions sample-env.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Misc
NUMERO_ALUNA=""
HORARIO_PDF = "link/to/pdf.pdf"
FACEBOOK_URL = "link/to/facebook/page"

# Google sheets
SHEET_NAME=""

# SQLite Database
DB_PASSWORD=""

# Email config
SMTP_SENDER=""
RECEIVER=""
SMTP_PWD=""

0 comments on commit b02bf7e

Please sign in to comment.