Automated flight price tracking from Providence (PVD) to Raleigh-Durham (RDU) using Google Flights data via SerpApi. Same prices you see on google.com/travel/flights, pulled automatically.
Go to serpapi.com and click Register (top right). After signing up and logging in, your API key is displayed on the dashboard page.
Free tier = 250 searches/month. Running the tracker once a day uses ~30/month.
Press Cmd + Space, type Terminal, hit Enter.
Paste this and hit Enter:
pip3 install google-search-results python-dotenvIf you see "command not found: pip3", run this first and then retry:
python3 -m ensurepip --upgradeAfter downloading and unzipping the project folder:
cd ~/Downloads/flight-tracker
cp .env.example .env
nano .envThis opens a simple text editor. Replace your_api_key_here with your actual key. Then press Ctrl + O (save), Enter, Ctrl + X (exit).
python3 tracker.py --depart 2026-07-01 --return 2026-07-07You should see flight prices, airlines, stops, and durations — same data as Google Flights.
# Basic price check
python3 tracker.py --depart 2026-07-01 --return 2026-07-07
# Set a price alert target
python3 tracker.py --depart 2026-07-01 --return 2026-07-07 --target 180
# Output as JSON
python3 tracker.py --depart 2026-07-01 --return 2026-07-07 --json
# View your price history log
python3 tracker.py --history
# Terminal chart of price trend
python3 dashboard.pyRun it daily without thinking about it.
Open Terminal and type:
crontab -eAdd this line (checks prices every day at 7 AM):
0 7 * * * cd ~/Downloads/flight-tracker && /usr/bin/python3 tracker.py --depart 2026-07-01 --return 2026-07-07
Save and exit (if using vim: press Esc, type :wq, hit Enter).
Get an email when prices drop below your target.
For Gmail:
- Go to myaccount.google.com/apppasswords
- Generate an App Password for "Mail"
- Fill in the SMTP fields in your
.envfile
| File | Purpose |
|---|---|
tracker.py |
Searches Google Flights, logs prices, alerts |
dashboard.py |
Terminal chart of your price history |
.env.example |
Template — copy to .env and add your key |
.env |
Your credentials (git-ignored) |
price_history.json |
Auto-generated log of every price check |
It pulls from Google Flights directly — same prices, same airlines, same results you'd see if you searched manually. The free tier is generous enough for daily tracking, and unlike other flight APIs, there's no sandbox/test mode — you get real data immediately.
Symptom: Your cron job is scheduled, the time passes, but price_history.json never gets updated. Manual runs from Terminal work fine.
Root cause: macOS uses TCC (Transparency, Consent, Control) to restrict which processes can access protected folders like Desktop, Documents, and Downloads. Unlike when you run scripts manually, cron has no way to prompt you for permission — it fails silently. This is especially common after moving the project folder into a protected location like Desktop.
Diagnosing the issue:
Confirm cron is actually firing (you should see entries at your scheduled time):
log show --predicate 'process == "cron"' --last 7d
If cron is firing but nothing is happening, the job itself is being blocked.
Fix #1 — Grant Full Disk Access to cron:
- Open System Settings → Privacy & Security → Full Disk Access
- Click the + button (authenticate with Touch ID / password if prompted)
- In the file picker, press Cmd + Shift + G to bring up "Go to Folder"
- Type
/usr/sbin/cronand press Enter - Click Open, then make sure the toggle next to
cronis ON
Fix #2 — Enable cron logging for future debugging:
Edit your crontab (crontab -e) and append >> /full/path/to/flight-tracker/cron.log 2>&1 to the end of your job line. Example:
0 18 * * * cd /Users/yourname/Desktop/flight-tracker && /usr/bin/python3 tracker.py --depart 2026-08-19 --return 2026-08-26 >> /Users/yourname/Desktop/flight-tracker/cron.log 2>&1
This captures all output (and errors) to cron.log so you can see exactly what happened on each run.
Testing without waiting:
Set a temporary cron line 2–3 minutes in the future, save, wait for it to fire, then check cron.log. Remove the test line once verified.
| Error | Fix |
|---|---|
command not found: python3 |
Use full path: /usr/bin/python3 |
No module named serpapi |
Run pip3 install google-search-results |
Operation not permitted on edit |
Run chmod 644 *.py .env.example .env |
PRICE_TARGET SyntaxError |
Python 3.9 — ensure global PRICE_TARGET is at the top of main() |