Skip to content

🎫 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

  1. Resolve URL → Follows cvent.me short-link redirect to the full web.cvent.com URL
  2. Navigate → Opens the page with Playwright Chromium (headless)
  3. Detect Slots → Finds all Select buttons (each with an aria-label like "Select Saturday, 21 Mar - 3:00pm, Free")
  4. Filter for Saturday → Only proceeds if a Saturday slot exists
  5. Fill Form → Fills all 13+ fields: name, age check, residency, DOB, gender, email, phone, organisation, health questions, emergency contact
  6. Select Slot → Clicks the Saturday slot's Select button
  7. Submit → Clicks the Next / Submit button
  8. Notify → Sends HTML email confirmation via Gmail SMTP
  9. 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
Email 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.