# Pyfr24
[](https://pyfr24.readthedocs.io/en/latest/?badge=latest)
A Python client for the [Flightradar24 API](https://fr24api.flightradar24.com/) that provides an interface to fetch, plot and analyze flight data. The package includes both a Python API and a command-line interface for accessing flight data.
**Full documentation:** [https://pyfr24.readthedocs.io/](https://pyfr24.readthedocs.io/)
## Installation
```bash
# Install from PyPI
pip install pyfr24
# Or from source
git clone https://github.com/stiles/pyfr24.git
cd pyfr24
pip install -e .
```
## Basic usage
### Python API
```python
from pyfr24 import FR24API
# Initialize the client
api = FR24API("your_api_token")
# Get flight tracks for a specific flight ID
tracks = api.get_flight_tracks("39bebe6e")
# Export flight data with enhanced features
output_dir = api.export_flight_data(
"39bebe6e",
background='esri-satellite', # Satellite background
orientation='horizontal', # 16:9 aspect ratio
timezone='America/New_York' # Convert to Eastern Time
)
```
**Full Python docs:** [https://pyfr24.readthedocs.io/en/latest/usage/api/](https://pyfr24.readthedocs.io/en/latest/usage/api/)
### Command-line interface
```bash
# Export flight data
pyfr24 export-flight --flight-id 39a84c3c --output-dir data/flight_39a84c3c
# Get live flights for an aircraft registration
pyfr24 live-flights --registration N12345
# Get flight positions within a bounding box (Los Angeles area)
pyfr24 flight-positions --bounds "33.5,-118.8,34.5,-117.5"
# Smart export with enhanced features
pyfr24 smart-export --flight UA2151 --date 2025-04-22 \
--timezone "America/New_York" \
--background esri-satellite
```
**Full CLI reference:** [https://pyfr24.readthedocs.io/en/latest/usage/cli/](https://pyfr24.readthedocs.io/en/latest/usage/cli/)
## API token
Your Flightradar24 API token can be provided:
1. Via environment variable:
```bash
export FLIGHTRADAR_API_KEY="your_api_token"
```
2. As a command-line argument:
```bash
pyfr24 --token "your_api_token" flight-summary --flight BA123
```
3. Through an interactive prompt when no token is provided
## Smart export (new!)
Easily export all data for a flight when you know the flight number and date, but not the internal flight ID. This command is ideal for quickly investigating incidents or flights reported in the news, as it will look up all matching flights for the given number and date, prompt you to select if there are multiple, and export all relevant data and visualizations in one step.
Export all data for a flight by flight number and date, with interactive selection if there are multiple matches:
```bash
pyfr24 smart-export --flight UA2151 --date 2025-04-22
```
- If multiple flights are found, you'll be prompted to select the correct one.
- The output directory is named automatically (e.g., `data/UA2151_2025-04-22_KEWR-KDEN_3a01b036`).
- A `toplines.json` file is created with a summary of the exported flight.
**Example output:**
```
Multiple flights found for UA2151 on 2025-04-22:
[0] 3a00e15e | KPWM KEWR | 2025-04-22T10:34–2025-04-22T11:46 | N37554 | B39M
[1] 3a01b036 | KEWR KDEN | 2025-04-22T14:48–2025-04-22T18:53 | N28457 | B739
Select a flight to export [0-1]: 1
...
Export complete!
```
## Features
- **Flight data retrieval** (live flights, historical tracks and detailed info)
- **Enhanced visualizations** with publication-ready design:
- Professional chart styling with clean typography and smart formatting
- Multiple map backgrounds (CartoDB, OpenStreetMap, ESRI satellite/topo)
- Timezone conversion with automatic DST handling
- Human-readable time labels and date formatting
- **Data export** in multiple formats (CSV, GeoJSON and KML)
- **Interactive CLI** export by flight number and date (`smart-export` command)
- **Comprehensive output** including topline summaries (`toplines.json`)
- **Robust error handling** and logging
- **Comprehensive testing**
## Contributing
Contributions are welcome. Please:
1. Fork the repository
2. Create a feature branch
3. Add tests for new functionality
4. Ensure all tests pass with `python run_tests.py`
5. Submit a pull request
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/stiles/pyfr24",
"name": "pyfr24",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "flightradar24, flight, tracking, aviation, api, cli",
"author": "Matt Stiles",
"author_email": "mattstiles@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/50/f5/7903ddf9ce59397af1fadb67de81ecab43a6159a0fb2daa00d82b333bc74/pyfr24-0.1.9.tar.gz",
"platform": null,
"description": "# Pyfr24\n\n[](https://pyfr24.readthedocs.io/en/latest/?badge=latest)\n\nA Python client for the [Flightradar24 API](https://fr24api.flightradar24.com/) that provides an interface to fetch, plot and analyze flight data. The package includes both a Python API and a command-line interface for accessing flight data.\n\n**Full documentation:** [https://pyfr24.readthedocs.io/](https://pyfr24.readthedocs.io/)\n\n## Installation\n\n```bash\n# Install from PyPI\npip install pyfr24\n\n# Or from source\ngit clone https://github.com/stiles/pyfr24.git\ncd pyfr24\npip install -e .\n```\n\n## Basic usage\n\n### Python API\n\n```python\nfrom pyfr24 import FR24API\n\n# Initialize the client\napi = FR24API(\"your_api_token\")\n\n# Get flight tracks for a specific flight ID\ntracks = api.get_flight_tracks(\"39bebe6e\")\n\n# Export flight data with enhanced features\noutput_dir = api.export_flight_data(\n \"39bebe6e\",\n background='esri-satellite', # Satellite background\n orientation='horizontal', # 16:9 aspect ratio\n timezone='America/New_York' # Convert to Eastern Time\n)\n```\n\n**Full Python docs:** [https://pyfr24.readthedocs.io/en/latest/usage/api/](https://pyfr24.readthedocs.io/en/latest/usage/api/)\n\n### Command-line interface\n\n```bash\n# Export flight data\npyfr24 export-flight --flight-id 39a84c3c --output-dir data/flight_39a84c3c\n\n# Get live flights for an aircraft registration\npyfr24 live-flights --registration N12345\n\n# Get flight positions within a bounding box (Los Angeles area)\npyfr24 flight-positions --bounds \"33.5,-118.8,34.5,-117.5\"\n\n# Smart export with enhanced features\npyfr24 smart-export --flight UA2151 --date 2025-04-22 \\\n --timezone \"America/New_York\" \\\n --background esri-satellite\n```\n\n**Full CLI reference:** [https://pyfr24.readthedocs.io/en/latest/usage/cli/](https://pyfr24.readthedocs.io/en/latest/usage/cli/)\n\n## API token\n\nYour Flightradar24 API token can be provided:\n\n1. Via environment variable:\n ```bash\n export FLIGHTRADAR_API_KEY=\"your_api_token\"\n ```\n\n2. As a command-line argument:\n ```bash\n pyfr24 --token \"your_api_token\" flight-summary --flight BA123\n ```\n\n3. Through an interactive prompt when no token is provided\n\n## Smart export (new!)\n\nEasily export all data for a flight when you know the flight number and date, but not the internal flight ID. This command is ideal for quickly investigating incidents or flights reported in the news, as it will look up all matching flights for the given number and date, prompt you to select if there are multiple, and export all relevant data and visualizations in one step.\n\nExport all data for a flight by flight number and date, with interactive selection if there are multiple matches:\n\n```bash\npyfr24 smart-export --flight UA2151 --date 2025-04-22\n```\n\n- If multiple flights are found, you'll be prompted to select the correct one.\n- The output directory is named automatically (e.g., `data/UA2151_2025-04-22_KEWR-KDEN_3a01b036`).\n- A `toplines.json` file is created with a summary of the exported flight.\n\n**Example output:**\n```\nMultiple flights found for UA2151 on 2025-04-22:\n[0] 3a00e15e | KPWM KEWR | 2025-04-22T10:34\u20132025-04-22T11:46 | N37554 | B39M\n[1] 3a01b036 | KEWR KDEN | 2025-04-22T14:48\u20132025-04-22T18:53 | N28457 | B739\nSelect a flight to export [0-1]: 1\n...\nExport complete!\n```\n\n## Features\n\n- **Flight data retrieval** (live flights, historical tracks and detailed info)\n- **Enhanced visualizations** with publication-ready design:\n - Professional chart styling with clean typography and smart formatting\n - Multiple map backgrounds (CartoDB, OpenStreetMap, ESRI satellite/topo)\n - Timezone conversion with automatic DST handling\n - Human-readable time labels and date formatting\n- **Data export** in multiple formats (CSV, GeoJSON and KML)\n- **Interactive CLI** export by flight number and date (`smart-export` command)\n- **Comprehensive output** including topline summaries (`toplines.json`)\n- **Robust error handling** and logging\n- **Comprehensive testing**\n\n## Contributing\n\nContributions are welcome. Please:\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass with `python run_tests.py`\n5. Submit a pull request\n\n## License\n\nThis project is licensed under the MIT License.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python client for the Flightradar24 API with CLI support",
"version": "0.1.9",
"project_urls": {
"Homepage": "https://github.com/stiles/pyfr24"
},
"split_keywords": [
"flightradar24",
" flight",
" tracking",
" aviation",
" api",
" cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6db8fb0131659c1f9f35955e1cc6124599da732328e23ede8159802027547bb2",
"md5": "f382467c8435291d05beb8c45529df81",
"sha256": "ae762ad1feaa9b7a607fd3529f7c30ee471fa753dea82216954c55e29163fa6a"
},
"downloads": -1,
"filename": "pyfr24-0.1.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f382467c8435291d05beb8c45529df81",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 27490,
"upload_time": "2025-08-02T19:46:50",
"upload_time_iso_8601": "2025-08-02T19:46:50.721083Z",
"url": "https://files.pythonhosted.org/packages/6d/b8/fb0131659c1f9f35955e1cc6124599da732328e23ede8159802027547bb2/pyfr24-0.1.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "50f57903ddf9ce59397af1fadb67de81ecab43a6159a0fb2daa00d82b333bc74",
"md5": "a8f6e42855e2931f8080d9da9a4981e1",
"sha256": "ebfbb81ba1c9fa83412666c068a7b316cf6b5b1fbb4aafe6d6122063fbb565dd"
},
"downloads": -1,
"filename": "pyfr24-0.1.9.tar.gz",
"has_sig": false,
"md5_digest": "a8f6e42855e2931f8080d9da9a4981e1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 26637,
"upload_time": "2025-08-02T19:46:51",
"upload_time_iso_8601": "2025-08-02T19:46:51.590068Z",
"url": "https://files.pythonhosted.org/packages/50/f5/7903ddf9ce59397af1fadb67de81ecab43a6159a0fb2daa00d82b333bc74/pyfr24-0.1.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-02 19:46:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stiles",
"github_project": "pyfr24",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyfr24"
}