🎫 Event Booker — Overview¶
Automatically monitors the DBS Sailing At The Bay Cvent registration page for available Saturday time slots, fills in the full registration form, submits the booking, and sends an email notification.
How It Works¶
- Resolve URL → Follows
cvent.meshort-link redirect to the fullweb.cvent.comURL - Navigate → Opens the page with Playwright Chromium (headless)
- Detect Slots → Finds all
Selectbuttons (each with anaria-labellike "Select Saturday, 21 Mar - 3:00pm, Free") - Filter for Saturday → Only proceeds if a Saturday slot exists
- Fill Form → Fills all 13+ fields: name, age check, residency, DOB, gender, email, phone, organisation, health questions, emergency contact
- Select Slot → Clicks the Saturday slot's
Selectbutton - Submit → Clicks the
Next/Submitbutton - Notify → Sends HTML email confirmation via Gmail SMTP
- Repeat → Scheduler checks every 30 minutes until booked
Technology Stack¶
| Layer | Technology | Purpose |
|---|---|---|
| Language | Python 3.13 | Application runtime |
| Browser Automation | Playwright (Chromium) | Navigate, fill forms, click, screenshot |
| Scheduling | APScheduler (BlockingScheduler + CronTrigger) | In-process cron-style recurring execution |
| Configuration | python-dotenv + .env file |
Externalised secrets and settings |
| smtplib (stdlib) + Gmail App Password | SMTP TLS notifications | |
| URL Resolution | urllib.request (stdlib) | Follow short URL redirects |
| CLI | argparse (stdlib) | Command-line interface modes |
| Logging | logging (stdlib) | Dual-output: stdout + file |
| State Management | Flag files (.booked, .stop) |
Prevent duplicate bookings, graceful shutdown |
| Process Management | systemd (Linux) | Daemon lifecycle, auto-restart, boot persistence |
| Cloud Infrastructure | AWS EC2 (Amazon Linux 2023) | 24/7 server hosting |
| Source Control | Git + GitHub | Version control and deployment source |
Project Structure¶
app_event_booker/
├── __init__.py
├── __main__.py # python -m entry point
├── main.py # CLI + scheduler
├── config.py # .env loader
├── crawler.py # Playwright browser automation
├── discovery.py # Page analysis / debug tool
├── notifier.py # Gmail SMTP notifications
├── requirements.txt
├── screenshots/ # Auto-created, stores PNGs at each step
└── discovery_output/ # Auto-created, stores discovery reports
CLI Modes¶
The application supports multiple execution modes via argparse:
python -m app_event_booker # Start cron scheduler (runs 24/7)
python -m app_event_booker --once # Single booking attempt, then exit
python -m app_event_booker --discover # Analyse page structure, dump to JSON
python -m app_event_booker --test-email # Send a test email to verify SMTP config
python -m app_event_booker --stop # Graceful shutdown of running scheduler
python -m app_event_booker --reset # Clear .booked flag to allow re-booking
Deployment¶
The application is deployed as a systemd-managed daemon on an AWS EC2 instance (Amazon Linux 2023). This means:
| Scenario | Behaviour |
|---|---|
| SSH session closed | ✅ Service keeps running (managed by OS, not terminal) |
| EC2 reboots | ✅ Auto-starts on boot |
| Process crashes | ✅ Auto-restarts after 30 seconds |
.stop flag created |
✅ Scheduler shuts down gracefully |
Screenshots¶
Coming soon
Screenshots of the booking flow will be added here.
→ View the full Architecture documentation with Mermaid diagrams showing the component architecture, booking pipeline, deployment infrastructure, and scheduler state machine.