Services
See the library quickstart to learn more.
fr24
¤
Classes:
Name | Description |
---|---|
FR24 |
|
FR24
¤
FR24(client: AsyncClient | None = None)
See docs quickstart.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
AsyncClient | None
|
The |
None
|
Methods:
Name | Description |
---|---|
login |
:param creds: Reads credentials from the environment variables or the |
Attributes:
Name | Type | Description |
---|---|---|
http |
The HTTP client for use in requests |
http
instance-attribute
¤
http = HTTPClient(
AsyncClient(http2=True) if client is None else client,
auth=auth,
grpc_headers=Headers(get_grpc_headers(auth=auth)),
json_headers=Headers(get_json_headers()),
)
The HTTP client for use in requests
login
async
¤
login(
creds: TokenSubscriptionKey
| UsernamePassword
| None
| Literal["from_env"] = "from_env",
) -> None
Parameters:
Name | Type | Description | Default |
---|---|---|---|
creds
|
TokenSubscriptionKey | UsernamePassword | None | Literal['from_env']
|
Reads credentials from the environment variables or the config file if |
'from_env'
|
service
¤
Classes:
Attributes:
Name | Type | Description |
---|---|---|
logger |
|
|
RequestT |
Arguments for the request |
|
WriteLocation |
TypeAlias
|
|
ServiceFactory
¤
Methods:
Attributes:
Name | Type | Description |
---|---|---|
http |
HTTPClient
|
|
SupportsFetch
¤
APIResult
¤
SupportsWriteTable
¤
Bases: Protocol
Methods:
Name | Description |
---|---|
write_table |
Writes the object to the given file path. |
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt,
when_file_exists: FileExistsBehaviour = "backup",
) -> None
Writes the object to the given file path.
FlightListService
¤
Bases: SupportsFetch[FlightListParams]
Flight list service.
Classes:
Name | Description |
---|---|
FetchAllArgs |
Arguments for fetching all pages of the flight list. |
Methods:
Name | Description |
---|---|
fetch |
Fetch the flight list. |
fetch_all |
Fetch all pages of the flight list. |
new_result_collection |
Create an empty list of flight list API results. |
FetchAllArgs
dataclass
¤
FetchAllArgs(
reg: str | None = None,
flight: str | None = None,
page: int = 1,
limit: int = 10,
timestamp: IntoTimestamp
| Literal["now"]
| None = "now",
delay: int = 5,
max_pages: int | None = None,
)
Bases: FlightListParams
Arguments for fetching all pages of the flight list.
Methods:
Name | Description |
---|---|
__post_init__ |
|
Attributes:
Name | Type | Description |
---|---|---|
delay |
int
|
Delay between requests in seconds. |
max_pages |
int | None
|
Maximum number of pages to fetch. |
reg |
str | None
|
Aircraft registration (e.g. |
flight |
str | None
|
Flight number (e.g. |
page |
int
|
Page number |
limit |
int
|
Number of results per page - use |
timestamp |
IntoTimestamp | Literal['now'] | None
|
Show flights with ATD before this Unix timestamp |
kind |
Literal['reg', 'flight']
|
|
ident |
str
|
|
delay
class-attribute
instance-attribute
¤
Delay between requests in seconds.
max_pages
class-attribute
instance-attribute
¤
Maximum number of pages to fetch.
limit
class-attribute
instance-attribute
¤
limit: int = 10
Number of results per page - use 100
if authenticated.
timestamp
class-attribute
instance-attribute
¤
timestamp: IntoTimestamp | Literal['now'] | None = 'now'
Show flights with ATD before this Unix timestamp
fetch
async
¤
fetch(
reg: str | None = None,
flight: str | None = None,
page: int = 1,
limit: int = 10,
timestamp: IntoTimestamp
| Literal["now"]
| None = "now",
) -> FlightListResult
Fetch the flight list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reg
|
str | None
|
Aircraft registration (e.g. |
None
|
flight
|
str | None
|
Flight number (e.g. |
None
|
page
|
int
|
Page number |
1
|
limit
|
int
|
Number of results per page - use |
10
|
timestamp
|
IntoTimestamp | Literal['now'] | None
|
Show flights with ATD before this Unix timestamp |
'now'
|
fetch_all
async
¤
fetch_all(
reg: str | None = None,
flight: str | None = None,
page: int = 1,
limit: int = 10,
timestamp: IntoTimestamp
| Literal["now"]
| None = "now",
delay: int = 5,
max_pages: int | None = None,
) -> AsyncIterator[FlightListResult]
Fetch all pages of the flight list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reg
|
str | None
|
Aircraft registration (e.g. |
None
|
flight
|
str | None
|
Flight number (e.g. |
None
|
page
|
int
|
Page number |
1
|
limit
|
int
|
Number of results per page - use |
10
|
timestamp
|
IntoTimestamp | Literal['now'] | None
|
Show flights with ATD before this Unix timestamp |
'now'
|
delay
|
int
|
Delay between requests in seconds. |
5
|
max_pages
|
int | None
|
Maximum number of pages to fetch. |
None
|
new_result_collection
¤
new_result_collection() -> FlightListResultCollection
Create an empty list of flight list API results.
Methods to_dict
and to_polars
can be used collect all unique rows in
each flight list.
FlightListResult
¤
Bases: APIResult[FlightListParams]
, SupportsToDict[FlightList]
, SupportsToPolars
, SupportsWriteTable
A single result from the flight list API.
Methods:
Name | Description |
---|---|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
FlightListResultCollection
¤
Bases: list[FlightListResult]
, SupportsToDict[FlightList]
, SupportsToPolars
, SupportsWriteTable
A list of results from the flight list API.
Methods:
Name | Description |
---|---|
to_dict |
Collects the raw bytes in each response into a single result. |
to_polars |
|
write_table |
|
to_dict
¤
to_dict() -> FlightList
Collects the raw bytes in each response into a single result. Duplicates are identified by their (flight id, time of departure), and are removed.
No checking is made for the homogenity of the request parameters.
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
PlaybackService
¤
Bases: SupportsFetch[PlaybackParams]
Playback service.
Methods:
Name | Description |
---|---|
fetch |
Fetch the playback data for a flight. |
fetch
async
¤
fetch(
flight_id: IntoFlightId,
timestamp: IntoTimestamp | None = None,
) -> PlaybackResult
Fetch the playback data for a flight.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flight_id
|
IntoFlightId
|
fr24 flight id, represented in hex |
required |
timestamp
|
IntoTimestamp | None
|
Actual time of departure (ATD) of the historic flight, Unix timestamp in seconds. Optional, but it is recommended to include it. |
None
|
PlaybackResult
¤
Bases: APIResult[PlaybackParams]
, SupportsToDict[Playback]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_dict |
|
to_polars |
|
metadata |
Extracts flight metadata from the response. |
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
LiveFeedService
¤
Bases: SupportsFetch[LiveFeedParams]
Live feed service.
Methods:
Name | Description |
---|---|
fetch |
Fetch the live feed. |
fetch
async
¤
fetch(
bounding_box: BoundingBox,
stats: bool = False,
limit: int = 1500,
maxage: int = 14400,
fields: set[LiveFeedField] = (
lambda: {"flight", "reg", "route", "type"}
)(),
) -> LiveFeedResult
Fetch the live feed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stats
|
bool
|
Whether to include stats in the given area. |
False
|
limit
|
int
|
Maximum number of flights (should be set to 1500 for unauthorized users, 2000 for authorized users). |
1500
|
maxage
|
int
|
Maximum time since last message update, seconds. |
14400
|
fields
|
set[LiveFeedField]
|
Fields to include. For unauthenticated users, a maximum of 4 fields can be included. When authenticated, |
(lambda: {'flight', 'reg', 'route', 'type'})()
|
LiveFeedResult
¤
Bases: APIResult[LiveFeedParams]
, SupportsToProto[LiveFeedResponse]
, SupportsToDict[dict[str, Any]]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
timestamp |
IntTimestampS
|
|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
LiveFeedPlaybackService
¤
Bases: SupportsFetch[LiveFeedPlaybackParams]
Live feed service.
Methods:
Name | Description |
---|---|
fetch |
Fetch a playback of the live feed. |
fetch
async
¤
fetch(
bounding_box: BoundingBox,
stats: bool = False,
limit: int = 1500,
maxage: int = 14400,
fields: set[LiveFeedField] = (
lambda: {"flight", "reg", "route", "type"}
)(),
timestamp: IntoTimestamp | Literal["now"] = "now",
duration: int = 7,
hfreq: int | None = None,
) -> LiveFeedPlaybackResult
Fetch a playback of the live feed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stats
|
bool
|
Whether to include stats in the given area. |
False
|
limit
|
int
|
Maximum number of flights (should be set to 1500 for unauthorized users, 2000 for authorized users). |
1500
|
maxage
|
int
|
Maximum time since last message update, seconds. |
14400
|
fields
|
set[LiveFeedField]
|
Fields to include. For unauthenticated users, a maximum of 4 fields can be included. When authenticated, |
(lambda: {'flight', 'reg', 'route', 'type'})()
|
timestamp
|
IntoTimestamp | Literal['now']
|
Start timestamp |
'now'
|
duration
|
int
|
Duration of prefetch, |
7
|
hfreq
|
int | None
|
High frequency mode |
None
|
LiveFeedPlaybackResult
¤
Bases: APIResult[LiveFeedPlaybackParams]
, SupportsToProto[PlaybackResponse]
, SupportsToDict[dict[str, Any]]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
AirportListService
¤
Bases: SupportsFetch[AirportListParams]
Airport list service.
Methods:
Name | Description |
---|---|
fetch |
Fetch the airport list. |
fetch
async
¤
fetch(
airport: str,
mode: Literal["arrivals", "departures", "ground"],
page: int = 1,
limit: int = 10,
timestamp: IntoTimestamp
| Literal["now"]
| None = "now",
) -> AirportListResult
Fetch the airport list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
airport
|
str
|
IATA airport code (e.g. |
required |
mode
|
Literal['arrivals', 'departures', 'ground']
|
arrivals, departures or on ground aircraft |
required |
page
|
int
|
Page number |
1
|
limit
|
int
|
Number of results per page - use |
10
|
timestamp
|
IntoTimestamp | Literal['now'] | None
|
Show flights with STA before this timestamp |
'now'
|
AirportListResult
¤
Bases: APIResult[AirportListParams]
, SupportsToDict[AirportList]
Methods:
Name | Description |
---|---|
to_dict |
Parse the response into a dictionary. |
Attributes:
Name | Type | Description |
---|---|---|
request |
RequestT
|
|
response |
Response
|
|
FindService
¤
Bases: SupportsFetch[FindParams]
Find service.
Methods:
Name | Description |
---|---|
fetch |
Fetch the find results. |
fetch
async
¤
fetch(query: str, limit: int = 50) -> FindResult
Fetch the find results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Airport, schedule (HKG-CDG), or aircraft. |
required |
FindResult
¤
Bases: APIResult[FindParams]
, SupportsToDict[Find]
A single result from the find API.
Methods:
Name | Description |
---|---|
to_dict |
Parse the response into a dictionary. |
Attributes:
Name | Type | Description |
---|---|---|
request |
RequestT
|
|
response |
Response
|
|
NearestFlightsService
¤
Bases: SupportsFetch[NearestFlightsParams]
Nearest flights service.
Methods:
Name | Description |
---|---|
fetch |
Fetch the nearest flights. |
NearestFlightsResult
¤
Bases: APIResult[NearestFlightsParams]
, SupportsToProto[NearestFlightsResponse]
, SupportsToDict[dict[str, Any]]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
timestamp |
IntTimestampS
|
|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
LiveFlightsStatusService
¤
Bases: SupportsFetch[LiveFlightsStatusParams]
Live flights status service.
Methods:
Name | Description |
---|---|
fetch |
Fetch the live flights status. |
fetch
async
¤
fetch(
flight_ids: Sequence[IntoFlightId],
) -> LiveFlightsStatusResult
Fetch the live flights status.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flight_ids
|
Sequence[IntoFlightId]
|
List of flight IDs to get status for |
required |
LiveFlightsStatusResult
¤
Bases: APIResult[LiveFlightsStatusParams]
, SupportsToProto[LiveFlightsStatusResponse]
, SupportsToDict[dict[str, Any]]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
timestamp |
IntTimestampS
|
|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
FollowFlightService
¤
Follow flight service for real-time streaming.
Methods:
Name | Description |
---|---|
stream |
Stream real-time flight updates. |
stream
async
¤
stream(
flight_id: IntoFlightId,
restriction_mode: ValueType | str | bytes = NOT_VISIBLE,
) -> AsyncGenerator[FollowFlightResult, None]
Stream real-time flight updates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flight_id
|
IntoFlightId
|
Flight ID to fetch details for. Must be live, or the response will contain an empty |
required |
restriction_mode
|
ValueType | str | bytes
|
FAA LADD visibility mode. |
NOT_VISIBLE
|
FollowFlightResult
¤
Bases: SupportsToProto[FollowFlightResponse]
, SupportsToDict[dict[str, Any]]
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
Attributes:
Name | Type | Description |
---|---|---|
request |
FollowFlightParams
|
|
response |
bytes
|
|
TopFlightsService
¤
Bases: SupportsFetch[TopFlightsParams]
Top flights service.
Methods:
Name | Description |
---|---|
fetch |
Fetch the top flights. |
fetch
async
¤
fetch(limit: int = 10) -> TopFlightsResult
Fetch the top flights.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
Maximum number of top flights to return (1-10) |
10
|
TopFlightsResult
¤
Bases: APIResult[TopFlightsParams]
, SupportsToProto[TopFlightsResponse]
, SupportsToDict[dict[str, Any]]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
timestamp |
IntTimestampS
|
|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
FlightDetailsService
¤
Bases: SupportsFetch[FlightDetailsParams]
Flight details service.
Methods:
Name | Description |
---|---|
fetch |
Fetch flight details. |
fetch
async
¤
fetch(
flight_id: IntoFlightId,
restriction_mode: ValueType | str | bytes = NOT_VISIBLE,
verbose: bool = True,
) -> FlightDetailsResult
Fetch flight details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flight_id
|
IntoFlightId
|
Flight ID to fetch details for. Must be live, or the response will contain an empty |
required |
restriction_mode
|
ValueType | str | bytes
|
FAA LADD visibility mode. |
NOT_VISIBLE
|
verbose
|
bool
|
Whether to include [fr24.proto.v1_pb2.FlightDetailsResponse.flight_plan] and [fr24.proto.v1_pb2.FlightDetailsResponse.aircraft_details] in the response. |
True
|
FlightDetailsResult
¤
Bases: APIResult[FlightDetailsParams]
, SupportsToProto[FlightDetailsResponse]
, SupportsToDict[dict[str, Any]]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
timestamp |
IntTimestampS
|
|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None
PlaybackFlightService
¤
Bases: SupportsFetch[PlaybackFlightParams]
Playback flight service.
Methods:
Name | Description |
---|---|
fetch |
Fetch playback flight details. |
fetch
async
¤
fetch(
flight_id: IntoFlightId, timestamp: IntoTimestamp
) -> PlaybackFlightResult
Fetch playback flight details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flight_id
|
IntoFlightId
|
Flight ID to fetch details for. Must not be live, or the response will contain an empty |
required |
timestamp
|
IntoTimestamp
|
Actual time of departure (ATD) of the historic flight |
required |
PlaybackFlightResult
¤
Bases: APIResult[PlaybackFlightParams]
, SupportsToProto[PlaybackFlightResponse]
, SupportsToDict[dict[str, Any]]
, SupportsToPolars
, SupportsWriteTable
Methods:
Name | Description |
---|---|
to_proto |
|
to_dict |
|
to_polars |
|
write_table |
|
Attributes:
Name | Type | Description |
---|---|---|
request |
RequestT
|
|
response |
Response
|
|
write_table
¤
write_table(
file: WriteLocation,
*,
format: TabularFileFmt = "parquet",
when_file_exists: FileExistsBehaviour = "backup",
) -> None