American Airlines hides the side-by-side comparison that would show whether cash or award bookings are the better deal. This project automates those checks and exposes the results through a simple FastAPI service.
- The challenge provides a single departure date, so searches are performed as One-Way itineraries.
- Only the
MAINandPREMIUM_ECONOMYcross-reference buckets can be reliably compared across cash and award responses today. - Award and cash data are matched via the
hashidentifier returned by AA's internal API; if either side omits a hash the flight is ignored. - The scraper currently targets adult passengers and expects airport codes in IATA format.
- Python 3.12
- Playwright (headless Firefox)
- FastAPI & Uvicorn
- uv (dependency and runtime manager)
- Docker (deployment packaging)
.
├── app/
│ ├── api/ # FastAPI routers
│ ├── core/ # Shared constants and configuration
│ ├── models/ # Pydantic response schemas
│ └── services/ # Scraper + aggregation logic
├── main.py # CLI entrypoint delegating to app.main
├── Dockerfile # Container image definition
├── pyproject.toml # Project metadata
└── uv.lock # Locked dependency graph
Operation Point Break runs a FastAPI boundary layer that routes requests into three cooperating services: browser_manager (Playwright lifecycle and concurrency), aa_client (session-bound AA fetch wrapper), and flight_service (pricing merge + CPP math). The API layer injects these services per request so the business logic stays testable and the Pydantic response schemas remain the single source of truth for payload structure.
Within the browser tier, the manager stands up dual browser engines (WebKit + Firefox) to rotate fingerprints to evade AA's browser-level bot detection, hydrates them through the AA booking flow, and uses a shared-page concurrency model so every incoming search can reuse a warm page rather than cold-starting a new context. A cooperative async dispatcher tracks request counts per page (rotating after 75), watches for Playwright crash signals, and brings replacement contexts online without dropping in-flight traffic. Session cookies and local storage are preserved across swaps to maintain bot-evasion parity.
Back-office work happens in the flight service: award and cash itineraries are fetched through the browser context, normalized to internal dataclasses, intersected on AA's hash identifier, and filtered down to cabins that expose complete pricing.
Putting that architecture in motion looks like this:
- A Playwright session loads AA's booking page headlessly, then executes the itinerary
fetchfrom inside the browser withcredentials: includeso AA recognizes it as a live customer session. - Two POSTs are issued per search: one for award pricing (
searchType="Award") and one for cash pricing (searchType="Revenue"). - Flights are intersected via the shared
hashfield. Each surviving flight pulls departure/arrival timestamps, the relevant cabin product groups, and the per-passenger prices. - CPP is computed as
(cash_price_usd - taxes_fees_usd) / points_required * 100, rounded to two decimals. Responses that lack the needed pricing blocks are skipped. - FastAPI exposes
/flightsfor the comparison and/healthfor readiness checks. Errors from AA's API propagate as502responses, while validation issues (e.g., unsupported cabin class) surface as400s. - Connectivity is validated against multiple Surfshark exit nodes (Argentina, US, EU) to ensure the flows survive geo shifts; residential-style Surfshark IPs stay reliable, while data-center ranges get consistently blocked by AA.
Latest achievements:
- Sustained 100+ sequential AA searches without rotating browser fingerprints or cooling down the Playwright session.
- Completed a 2-minute load test at 6.81 requests/second (867 total) with 0.00% error rate and a 3,338 ms average response while maintaining bot-evasion parity.
- Install dependencies and browsers:
uv sync uv run playwright install firefox
- Start the API server:
uv run uvicorn app.main:app --host 0.0.0.0 --port 8000
- Call the comparison endpoint:
curl "http://localhost:8000/flights?origin=LAX&destination=JFK&date=2025-12-15&passengers=1&cabin_class=main"
docker build -t point-break .
docker run --rm -p 8000:8000 point-breakAlternatively, run the published image directly:
docker run --rm -p 8000:8000 maxilr/point-break:latestNote: containerized runs may have constrained CPU, memory, or network resources, so observed performance might differ from bare-metal expectations.
GET /health→{ "status": "ok" }GET /flights→ acceptsorigin,destination,date,passengers,cabin_classas query string parameters and returns the pricing comparison payload.
{
"search_metadata": {
"origin": "LAX",
"destination": "JFK",
"date": "2025-12-15",
"passengers": 1,
"cabin_class": "main"
},
"flights": [
{
"flight_number": "AA123",
"departure_time": "08:00",
"arrival_time": "16:30",
"points_required": 12500,
"cash_price_usd": 289.0,
"taxes_fees_usd": 5.6,
"cpp": 2.27
},
{
"flight_number": "AA456",
"departure_time": "14:15",
"arrival_time": "22:45",
"points_required": 10000,
"cash_price_usd": 189.0,
"taxes_fees_usd": 5.6,
"cpp": 1.83
}
],
"total_results": 2
}The example illustrates the required response shape; live numbers depend on real-time AA availability.
- The bot evasion strategy relies on Playwright maintaining real browser fingerprints and cookies. For higher resilience you can rotate user agents, add random delays, or proxy requests, though AA's current flows already accept this approach.
- Extend the
AVAILABLE_CROSS_REFERENCESlist to support more cabins once AA exposes consistent identifiers for them across award and cash searches.
Further enhancement for perpetual functioning can be achieved by implementing a proxy rotation strategy on top of browser fingerprinting rotation to reduce proxy usage. To withstand bigger concurrent loads horizontal scalability of this service is suggested with an L4 Load Balancer.
