How ajai-k/echallan-scraper-api works
Vehicle Challan API looks up traffic challans from Parivahan, returning fresh cached records or scraping the portal when needed. Its main path runs from an API client through authenticated FastAPI routes and service orchestration to portal scraping, OCR-assisted captcha solving, reconciliation in the database, and serialized responses with document links. A scheduled refresh and a standalone CLI are separate entry paths. The README documents additional query and document-serving capabilities; unsampled implementation details are represented only where those relationships are explicit.
Main entry points: app.py FastAPI routes · service.py Lookup orchestration · scraper.py Portal scraper · db.py Vehicle and challan store
Components 15
HTTP API
- FastAPI routes
app.py - Document serving
app.py
Lookup and refresh
- Lookup orchestration
service.py - Refresh scheduler
app.py - Date-range queries
service.py - Standalone lookup CLI
fetch_challan.py
Portal acquisition
- Portal scraper
scraper.py - Captcha OCR
captcha_solver.py
Persistence and configuration
- Downloaded documents
- Reconciliation and serialization
service.py - Vehicle and challan store
db.py - Runtime configuration
config.py
Other components
- API client
- Parivahan portal
- MySQL or SQLite
Connections 21
- API client → FastAPI routes: requests
README.md - FastAPI routes → Lookup orchestration: looks up
app.py - FastAPI routes → Lookup orchestration: queries dates
app.py - FastAPI routes → Vehicle and challan store: lists vehicles
app.py - FastAPI routes → Refresh scheduler: triggers refresh
app.py - Refresh scheduler → Lookup orchestration: schedules refresh
app.py - FastAPI routes → Document serving: mounts files
app.py - Document serving → Downloaded documents: serves documents
README.md - Lookup orchestration → Vehicle and challan store: reads and writes
service.py - Lookup orchestration → Portal scraper: scrapes vehicle
service.py - Lookup orchestration → Runtime configuration: checks cache TTL
service.py - Lookup orchestration → Reconciliation and serialization: reconciles and serializes
service.py - Date-range queries → Vehicle and challan store: queries challans
service.py - Standalone lookup CLI → Portal scraper: fetches directly
fetch_challan.py - Portal scraper → Captcha OCR: solves captcha
scraper.py - Portal scraper → Parivahan portal: submits lookup
README.md - Portal scraper → Parivahan portal: downloads notices
README.md - Portal scraper → Downloaded documents: downloads documents
README.md - Vehicle and challan store → MySQL or SQLite: persists records
db.py - FastAPI routes → Runtime configuration: uses settings
app.py - Reconciliation and serialization → Runtime configuration: builds document links
service.py