Important
This module is still pre-release and may be incomplete.
A small collection of command-line tools for working with a personal flight log stored in a GeoPackage.
If you want to install this module locally and access it from any folder, while still allowing the scripts to be edited after install, perform a pip editable installation:
cd path/to/module
python -m pip install -e .This package interacts with a GeoPackage flight log database as described in the schema. The path to this file must be set as an environment variable:
FLIGHT_LOG_GEOPACKAGE_PATH=/path/to/flight_log.gpkg
This package has the ability to import files from a predefined import folder. The path to this folder must be set as an environment variable:
FLIGHT_LOG_IMPORT_PATH=/path/to/import/folder
Many of these scripts interact with AeroAPI to get flight data. You will need to get an AeroAPI API key and set it as an environment variable:
AEROAPI_API_KEY=yourkey
Important
When these scripts call AeroAPI with your API key, you will incur AeroAPI per-query fees as appropriate for your AeroAPI account.
The add flight --recent script also requires a Flight Historian API key to be set as an environment variable:
FLIGHT_HISTORIAN_API_KEY=yourkey
Note
Throughout this documentation, python refers to the Python 3 interpreter. Different operating systems may require different commands such as py or python3.
python -m pbflightlog <command> [options]To see available commands:
python -m pbflightlog --helpTo see help for a specific command:
python -m pbflightlog <command> --helpCreate a new flight (or new flights) in the flight log.
Important
Flight data is pulled from AeroAPI, so an API key must be set in environment variables.
-
--bcbp <bcbp_text>: Parse a string coded in the IATA Bar-Coded Boarding Pass (BCBP) format, and add the flight(s) it represents to the log.You can get this string by scanning the 2-D barcode on a boarding pass with a barcode reader app.
Example:
python -m pbflightlog add flight --bcbp "M1DOE/JOHN EABC123 BOSJFKB6 0717 345P014C0010 147>3180 M6344BB6 29279 0 B6 B6 1234567890 ^108abcdefgh"Since BCBP data contains spaces, be sure to place the BCBP string in quotes. Do not trim trailing spaces from the string, as spaces have meaning in the BCBP format.
-
--fa-flight-id <fa_flight_id>: Look up a flight on AeroAPI byfa_flight_idand add it to the flight log.Example:
python -m pbflightlog add flight --fa-flight-id UAL1234-1234567890-airline-0123
-
--number <airline_code> <flight_number>: Look up an airline and flight number on AeroAPI and add it to the flight log.To reduce ambiguity, ICAO airline codes (three letter codes, like
AAL) are preferred. However, this will attempt to look up IATA airline codes (two character codes, likeAA).Example:
python -m pbflightlog add flight --number AAL 1234
-
--pkpasses: Fetch all PKPass (Apple Wallet) files from the import folder and add them to the flight log.Example:
python -m pbflightlog add flight --pkpasses
-
--recent: Add recent flights from Flight Historian.This looks up all flights from Flight Historian within the last 10 days, and adds them if they have not already been added.
Example:
python -m pbflightlog add flight --recent
Updates the routes table based on all routes present in the flights table. Generates great circle geometry for these routes.
Warning
This will overwrite the routes table, including removing routes that no longer have flights. Do not manually edit the routes table, as any edits will be lost when routes are updated.
Example:
python -m pbflightlog update-routes