|
||
---|---|---|
flights | ||
LICENSE | ||
README.md | ||
run_backup |
Flight History Backup and Display Scripts
Introduction
These Python scripts allow you to automate the process of downloading and displaying your flight history from OpenFlights. You can use the backup script to regularly download a CSV backup of your flight data, and the display script to list your past and future flights. This README will guide you through setting up and using these scripts.
Prerequisites
Before you begin, make sure you have the following requirements installed:
- Python 3.x
- Playwright for web automation (used by the backup script)
Installation
-
Clone or download this repository to your local machine.
git clone https://git.4angle.com/edward/flights.git
-
Install the required Python modules for the scripts.
pip install playwright
-
Create a configuration file for your OpenFlights account. You can use the provided sample config file as a template (
config
). Update theusername
andpassword
fields with your OpenFlights login credentials.[backup] backup_dir=/path/to/backup/directory username=YourOpenFlightsUsername password=YourOpenFlightsPassword [history] days=120
Usage
Backup Script (run_backup
)
The backup script automates the process of downloading a CSV backup of your flight history from OpenFlights. You can schedule this script to run periodically, such as daily using cron.
-
Open your terminal and navigate to the directory where you cloned or downloaded the scripts.
-
Run the backup script:
python run_backup.py
This script will launch a headless browser, log in to your OpenFlights account, and download the CSV backup to the specified directory in your configuration file.
-
You can schedule this script to run daily using cron or any other scheduling tool. For example, to run it every day at 2 AM, add the following line to your crontab:
0 2 * * * /usr/bin/python3 /path/to/openflights-scripts/run_backup
Display Script (flights
)
The display script reads the downloaded CSV backup and displays a list of your past and future flights within a specified date range.
-
Open your terminal and navigate to the directory where you cloned or downloaded the scripts.
-
Run the display script:
python flights
This script will read the most recent CSV backup file in the specified directory, filter flights based on the configured date range, and display the results.
Customization
You can customize the scripts further by modifying the configuration file
(config
) or the scripts themselves. For example, you can adjust the number of
days to look back for past flights or customize the display format.
License
This project is licensed under the MIT License - see the LICENSE file for details.