Quick start guide¶
This guide provides a basic introduction to using Pyfr24 for accessing flight data.
Installation¶
API token setup¶
Before using Pyfr24, you'll need a Flightradar24 API token. You can provide it in one of three ways:
-
Environment variable:
-
Command-line argument:
-
Interactive prompt (when no token is provided)
Basic examples¶
Python API¶
import os
from pyfr24 import FR24API
# Get token from environment
token = os.environ.get("FLIGHTRADAR_API_KEY")
api = FR24API(token)
# Get live flights for an aircraft
live_flights = api.get_live_flights_by_registration("N12345")
# Get flight tracks
tracks = api.get_flight_tracks("39bebe6e")
# Export flight data
output_dir = api.export_flight_data(
"39bebe6e",
background='osm',
orientation='horizontal'
)
print(f"Data exported to: {output_dir}")
Command-line interface¶
# Get flight summary
pyfr24 flight-summary --flight AA123 --from-date "2023-01-01" --to-date "2023-01-01"
# Export flight data
pyfr24 export-flight --flight-id 39bebe6e --output-dir flight_data
# Get live flights
pyfr24 live-flights --registration N12345
Next steps¶
- Explore the Python API reference for more details on available methods
- Check the CLI reference for all command-line options
- Look at examples for more advanced usage scenarios