Initial commit: boarding pass to AirTrail pipeline
Photograph/screenshot a boarding pass, decode its BCBP barcode (PDF417/ Aztec/QR/DataMatrix), fetch the historical flight track from FlightAware the day after the flight, stage it for review, and write it into AirTrail via its REST API on approval. ntfy notifications carry signed Approve/Deny/Investigate actions.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
INSTANCE_DIR = Path(os.environ.get("INSTANCE_DIR", BASE_DIR / "instance"))
|
||||
UPLOADS_DIR = INSTANCE_DIR / "uploads"
|
||||
DB_PATH = INSTANCE_DIR / "boarding_pass.db"
|
||||
|
||||
PORT = int(os.environ.get("PORT", "8080"))
|
||||
MAX_UPLOAD_MB = int(os.environ.get("MAX_UPLOAD_MB", "15"))
|
||||
|
||||
PUBLIC_BASE_URL = os.environ.get("PUBLIC_BASE_URL", "").rstrip("/")
|
||||
AIRTRAIL_BASE_URL = os.environ.get("AIRTRAIL_BASE_URL", "").rstrip("/")
|
||||
AIRTRAIL_API_KEY = os.environ.get("AIRTRAIL_API_KEY", "")
|
||||
|
||||
FLIGHTAWARE_USER_AGENT = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
||||
"(KHTML, like Gecko) Chrome/124.0 Safari/537.36"
|
||||
)
|
||||
|
||||
MAX_TRACK_POINTS = 2000
|
||||
MAX_FETCH_ATTEMPTS = 5
|
||||
|
||||
|
||||
def ensure_dirs() -> None:
|
||||
INSTANCE_DIR.mkdir(parents=True, exist_ok=True)
|
||||
UPLOADS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
Reference in New Issue
Block a user