Skip to content

adameubanks/trip-daddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TripDaddy - Flight Deal Scanner

Simple flight deal scanner that scans flights based on criteria in config.json and emails the best deals.

Features

  • Scans international flights from SLC/PVU for 6-10 day trips during summer break
  • Filters by price thresholds and stops
  • In-memory rate limiting to prevent API cost overruns
  • Email notifications with best deals (or summary when no deals found)
  • All configuration in config.json

Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. Create a .env file in the project root with your credentials:

    # Create .env file
    touch .env

    Add the following to .env:

    RAPIDAPI_KEY=your-rapidapi-key-here
    EMAIL_SMTP_USER=your-email@gmail.com
    EMAIL_SMTP_PASSWORD=your-app-password-here
    EMAIL_TO=recipient@example.com

    Note: For Gmail, you'll need to use an App Password instead of your regular password.

  3. Configure config.json (optional):

    • Adjust origins, date ranges, trip lengths, and price thresholds as needed
    • Set rate limits to match your API plan
    • Note: Secrets are loaded from .env, not config.json

Running

Start the API server:

uvicorn app.main:app --reload

API Endpoints

  • POST /scan - Scans flights and immediately emails the best deals found (or summary if no deals)
  • GET /status - Shows rate limit usage

Configuration

Secrets (in .env file - not committed to git):

  • RAPIDAPI_KEY - Your RapidAPI key
  • EMAIL_SMTP_USER - Email address for sending
  • EMAIL_SMTP_PASSWORD - Email app password
  • EMAIL_TO - Email address to receive deals

Non-secret settings (in config.json - can be committed):

  • origins - Origin airports with coordinates
  • date_ranges - Date ranges to scan
  • trip_lengths - Trip lengths in days (array)
  • filters - Max stops and price thresholds by region
  • rate_limits - Monthly and daily API limits
  • api.results_per_request - Number of results per API call
  • api.min_delay_seconds - Delay between API calls (to avoid 429 errors)
  • email.smtp_host - SMTP server hostname
  • email.smtp_port - SMTP server port
  • scan.max_deals_per_notification - Max deals per email

Rate Limiting

The app enforces strict rate limits to prevent API cost overruns:

  • Monthly limit (default: 300 requests)
  • Daily limit (default: 10 requests)
  • Limits are configurable in config.json
  • Rate limiting is in-memory only (resets on server restart)

How It Works

  1. Call POST /scan to trigger a scan
  2. The app searches for flights matching your criteria (scans in weekly chunks to cover the full date range)
  3. Best deals are automatically sorted by price
  4. Top deals are immediately emailed to you (or a summary if no deals found)
  5. No persistent storage - each scan is independent

Testing

Test scripts are available in the scripts/ directory:

  • test_api.py - Test API endpoints
  • test_email.py - Test email configuration

Notes

  • Rate limiting resets when the server restarts (in-memory only)
  • The scan will automatically stop if API quota is exceeded (429 errors)
  • Full scan requires ~180 API requests (spread across multiple days with default daily limit)

About

scan for crazy cheap flight deals delivered to your inbox!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages