why i built a python bot to automate my class attendance
a story about morning classes, 8am lectures, and how 20 lines of python saved my semester.
It was 7:45 AM on a freezing Tuesday morning. My alarm was screaming at me from across the room. I had an 8:00 AM lecture—a class where the professor took attendance by posting a QR code on the screen for exactly 120 seconds.
Miss those two minutes? Marked absent. Miss 3 classes? Dropped a full letter grade. As a night-owl developer who writes their best code between 1 AM and 4 AM, this policy was my worst enemy.
the realization
One morning, while groggily scanning the QR code with one eye open, I looked at the URL it opened:
https://portal.university.edu/checkin?session_id=98231&token=abc123xyz
My developer brain immediately kicked in. The URL followed a completely predictable pattern. The session token was generated using a simple timestamp hash. I didn't need to be sitting in that cold lecture hall at 8:00 AM—I just needed Python.
how it worked
That night, I opened VS Code and spent 45 minutes building a lightweight automation script. Here's what the logic looked like:
import requests
import time
def auto_checkin(student_id, session_token):
url = "https://university-portal.edu/api/attendance/checkin"
headers = {"Authorization": f"Bearer {session_token}"}
payload = {"student_id": student_id, "status": "PRESENT"}
res = requests.post(url, json=payload, headers=headers)
return res.status_code == 200
# Run bot 5 minutes before class ends
time.sleep(300)
auto_checkin("STU_88412", "tok_live_992a")The script ran automatically on my cloud server every morning at 7:58 AM.
It fetched the active session token directly from the portal's open API endpoint.
It sent the check-in payload and fired a Telegram notification to my phone: "marked present!"
click "run live bot simulation" below to test the automated script workflow...
the outcome
It worked flawlessly for an entire semester. I had 100% attendance in an 8:00 AM class that I rarely attended in person. My grades went up because I was actually getting 8 hours of sleep.
Eventually, the university upgraded their system to require Bluetooth proximity beacons, which officially retired the bot. Targeting systems and finding clever workarounds is what made me love software automation.