Skip to content

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 httpx client to use. If not provided, a new one will be created with HTTP/2 enabled by default. It is highly recommended to use http2=True to avoid 464 errors and to be consistent with the browser.

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

flight_list

Flight list service.

playback

Playback service.

live_feed

Live feed service.

live_feed_playback

Live feed playback service.

airport_list

Airport list service.

find

Find service.

nearest_flights

Nearest flights service.

live_flights_status

Live flights status service.

follow_flight

Follow flight service.

top_flights

Top flights service.

flight_details

Flight details service.

playback_flight

Playback flight service.

http instance-attribute ¤

http = HTTPClient(
    AsyncClient(http2=True) if client is None else client
)

The HTTP client for use in requests

flight_list instance-attribute ¤

flight_list = build_flight_list()

Flight list service.

playback instance-attribute ¤

playback = build_playback()

Playback service.

live_feed instance-attribute ¤

live_feed = build_live_feed()

Live feed service.

live_feed_playback instance-attribute ¤

live_feed_playback = build_live_feed_playback()

Live feed playback service.

airport_list instance-attribute ¤

airport_list = build_airport_list()

Airport list service.

find instance-attribute ¤

find = build_find()

Find service.

nearest_flights instance-attribute ¤

nearest_flights = build_nearest_flights()

Nearest flights service.

live_flights_status instance-attribute ¤

live_flights_status = build_live_flights_status()

Live flights status service.

follow_flight instance-attribute ¤

follow_flight = build_follow_flight()

Follow flight service.

top_flights instance-attribute ¤

top_flights = build_top_flights()

Top flights service.

flight_details instance-attribute ¤

flight_details = build_flight_details()

Flight details service.

playback_flight instance-attribute ¤

playback_flight = build_playback_flight()

Playback flight service.

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 creds is set to "from_env" (default). Otherwise, provide the credentials directly.

'from_env'

service ¤

Classes:

Name Description
ServiceFactory
SupportsFetch
APIResult

Wraps the raw Response with request context.

SupportsWriteTable
FlightListService

Flight list service.

FlightListResult

A single result from the flight list API.

FlightListResultCollection

A list of results from the flight list API.

PlaybackService

Playback service.

PlaybackResult
LiveFeedService

Live feed service.

LiveFeedResult
LiveFeedPlaybackService

Live feed service.

LiveFeedPlaybackResult
AirportListService

Airport list service.

AirportListResult
FindService

Find service.

FindResult

A single result from the find API.

NearestFlightsService

Nearest flights service.

NearestFlightsResult
LiveFlightsStatusService

Live flights status service.

LiveFlightsStatusResult
FollowFlightService

Follow flight service for real-time streaming.

FollowFlightResult
TopFlightsService

Top flights service.

TopFlightsResult
FlightDetailsService

Flight details service.

FlightDetailsResult
PlaybackFlightService

Playback flight service.

PlaybackFlightResult

Attributes:

Name Type Description
RequestT

Arguments for the request

WriteLocation TypeAlias

_log module-attribute ¤

_log = getLogger(__name__)

RequestT module-attribute ¤

RequestT = TypeVar('RequestT')

Arguments for the request

WriteLocation module-attribute ¤

WriteLocation: TypeAlias = Union[
    str, Path, IO[bytes], FR24Cache
]

ServiceFactory dataclass ¤

ServiceFactory(http: HTTPClient)

Methods:

Name Description
build_flight_list
build_playback
build_live_feed
build_live_feed_playback
build_airport_list
build_find
build_nearest_flights
build_live_flights_status
build_flight_details
build_top_flights
build_follow_flight
build_playback_flight

Attributes:

Name Type Description
http HTTPClient

http instance-attribute ¤

http: HTTPClient

build_flight_list ¤

build_flight_list() -> FlightListService

build_playback ¤

build_playback() -> PlaybackService

build_live_feed ¤

build_live_feed() -> LiveFeedService

build_live_feed_playback ¤

build_live_feed_playback() -> LiveFeedPlaybackService

build_airport_list ¤

build_airport_list() -> AirportListService

build_find ¤

build_find() -> FindService

build_nearest_flights ¤

build_nearest_flights() -> NearestFlightsService

build_live_flights_status ¤

build_live_flights_status() -> LiveFlightsStatusService

build_flight_details ¤

build_flight_details() -> FlightDetailsService

build_top_flights ¤

build_top_flights() -> TopFlightsService

build_follow_flight ¤

build_follow_flight() -> FollowFlightService

build_playback_flight ¤

build_playback_flight() -> PlaybackFlightService

SupportsFetch ¤

Bases: Protocol[RequestT]

Methods:

Name Description
fetch

Fetches data from the API.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> APIResult[RequestT]

Fetches data from the API.

APIResult dataclass ¤

APIResult(request: RequestT, response: Response)

Bases: Generic[RequestT]

Wraps the raw Response with request context.

Note that at this stage, the response holds the raw bytes, possibly encoded with a scheme. Retrieve the raw bytes with response.content or parse it into json with response.json().

Attributes:

Name Type Description
request RequestT
response Response

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

SupportsWriteTable ¤

Bases: Protocol

Methods:

Name Description
write_table

Writes the object to the given file path.

write_table ¤

write_table(file: WriteLocation) -> None

Writes the object to the given file path.

FlightListService dataclass ¤

FlightListService(__factory: ServiceFactory)

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,
)

Bases: FlightListParams

Arguments for fetching all pages of the flight list.

Methods:

Name Description
__post_init__

Attributes:

Name Type Description
delay int
reg str | None

Aircraft registration (e.g. B-HUJ)

flight str | None

Flight number (e.g. CX8747)

page int

Page number

limit int

Number of results per page - use 100 if authenticated.

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: int = field(default=5)
reg class-attribute instance-attribute ¤
reg: str | None = None

Aircraft registration (e.g. B-HUJ)

flight class-attribute instance-attribute ¤
flight: str | None = None

Flight number (e.g. CX8747)

page class-attribute instance-attribute ¤
page: int = 1

Page number

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

kind property ¤
kind: Literal['reg', 'flight']
ident property ¤
ident: str
__post_init__ ¤
__post_init__() -> None

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> FlightListResult

Fetch the flight list. See fr24.json.FlightListParams for the detailed signature.

fetch_all async ¤

fetch_all(
    *args: Any, **kwargs: Any
) -> AsyncIterator[FlightListResult]

Fetch all pages of the flight list.

See fr24.service.FlightListService.FetchAllArgs for the detailed signature.

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 dataclass ¤

FlightListResult(request: RequestT, response: Response)

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

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_dict ¤

to_dict() -> FlightList

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> 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.

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

PlaybackService dataclass ¤

PlaybackService(__factory: ServiceFactory)

Bases: SupportsFetch[PlaybackParams]

Playback service.

Methods:

Name Description
fetch

See fr24.json.PlaybackParams for the detailed signature.

metadata

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> PlaybackResult

See fr24.json.PlaybackParams for the detailed signature.

metadata classmethod ¤

metadata(response_dict: Playback) -> dict[str, Any]

PlaybackResult dataclass ¤

PlaybackResult(request: RequestT, response: Response)

Bases: APIResult[PlaybackParams], SupportsToDict[Playback], SupportsToPolars, SupportsWriteTable

Methods:

Name Description
to_dict
to_polars
write_table

Attributes:

Name Type Description
request RequestT
response Response

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_dict ¤

to_dict() -> Playback

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

LiveFeedService dataclass ¤

LiveFeedService(__factory: ServiceFactory)

Bases: SupportsFetch[LiveFeedParams]

Live feed service.

Methods:

Name Description
fetch

Fetch the live feed.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> LiveFeedResult

Fetch the live feed. See fr24.grpc.LiveFeedParams for the detailed signature.

LiveFeedResult dataclass ¤

LiveFeedResult(
    request: RequestT, response: Response, timestamp: int
)

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 int
request RequestT
response Response

timestamp instance-attribute ¤

timestamp: int

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_proto ¤

to_proto() -> LiveFeedResponse

to_dict ¤

to_dict() -> dict[str, Any]

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

LiveFeedPlaybackService dataclass ¤

LiveFeedPlaybackService(__factory: ServiceFactory)

Bases: SupportsFetch[LiveFeedPlaybackParams]

Live feed service.

Methods:

Name Description
fetch

Fetch a playback of the live feed.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> LiveFeedPlaybackResult

Fetch a playback of the live feed. See fr24.grpc.LiveFeedPlaybackParams for the detailed signature.

LiveFeedPlaybackResult dataclass ¤

LiveFeedPlaybackResult(
    request: RequestT, response: Response
)

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

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_proto ¤

to_proto() -> PlaybackResponse

to_dict ¤

to_dict() -> dict[str, Any]

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

AirportListService dataclass ¤

AirportListService(__factory: ServiceFactory)

Bases: SupportsFetch[AirportListParams]

Airport list service.

Methods:

Name Description
fetch

Fetch the airport list.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> AirportListResult

Fetch the airport list. See fr24.json.AirportListParams for the detailed signature.

AirportListResult dataclass ¤

AirportListResult(request: RequestT, response: Response)

Bases: APIResult[AirportListParams], SupportsToDict[AirportList]

Methods:

Name Description
to_dict

Parse the response into a dictionary.

Attributes:

Name Type Description
request RequestT
response Response

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_dict ¤

to_dict() -> AirportList

Parse the response into a dictionary.

FindService dataclass ¤

FindService(__factory: ServiceFactory)

Bases: SupportsFetch[FindParams]

Find service.

Methods:

Name Description
fetch

Fetch the find results.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> FindResult

Fetch the find results. See fr24.json.FindParams for the detailed signature.

FindResult dataclass ¤

FindResult(request: RequestT, response: Response)

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

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_dict ¤

to_dict() -> Find

Parse the response into a dictionary.

NearestFlightsService dataclass ¤

NearestFlightsService(__factory: ServiceFactory)

Bases: SupportsFetch[NearestFlightsParams]

Nearest flights service.

Methods:

Name Description
fetch

Fetch the nearest flights.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> NearestFlightsResult

Fetch the nearest flights. See fr24.grpc.NearestFlightsParams for the detailed signature.

NearestFlightsResult dataclass ¤

NearestFlightsResult(
    request: RequestT, response: Response, timestamp: int
)

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 int
request RequestT
response Response

timestamp instance-attribute ¤

timestamp: int

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_proto ¤

to_proto() -> NearestFlightsResponse

to_dict ¤

to_dict() -> dict[str, Any]

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

LiveFlightsStatusService dataclass ¤

LiveFlightsStatusService(__factory: ServiceFactory)

Bases: SupportsFetch[LiveFlightsStatusParams]

Live flights status service.

Methods:

Name Description
fetch

Fetch the live flights status.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> LiveFlightsStatusResult

Fetch the live flights status. See fr24.grpc.LiveFlightsStatusParams for the detailed signature.

LiveFlightsStatusResult dataclass ¤

LiveFlightsStatusResult(
    request: RequestT, response: Response, timestamp: int
)

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 int
request RequestT
response Response

timestamp instance-attribute ¤

timestamp: int

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_proto ¤

to_proto() -> LiveFlightsStatusResponse

to_dict ¤

to_dict() -> dict[str, Any]

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

FollowFlightService dataclass ¤

FollowFlightService(__factory: ServiceFactory)

Follow flight service for real-time streaming.

Methods:

Name Description
stream

Stream real-time updates for a flight.

stream async ¤

stream(
    *args: Any, **kwargs: Any
) -> AsyncGenerator[FollowFlightResult, None]

Stream real-time updates for a flight. See fr24.grpc.FollowFlightParams for the detailed signature.

FollowFlightResult dataclass ¤

FollowFlightResult(
    request: FollowFlightParams, response: bytes
)

Bases: SupportsToProto[FollowFlightResponse], SupportsToDict[dict[str, Any]]

Methods:

Name Description
to_proto
to_dict

Attributes:

Name Type Description
request FollowFlightParams
response bytes

request instance-attribute ¤

response instance-attribute ¤

response: bytes

to_proto ¤

to_proto() -> FollowFlightResponse

to_dict ¤

to_dict() -> dict[str, Any]

TopFlightsService dataclass ¤

TopFlightsService(__factory: ServiceFactory)

Bases: SupportsFetch[TopFlightsParams]

Top flights service.

Methods:

Name Description
fetch

Fetch the top flights.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> TopFlightsResult

Fetch the top flights. See fr24.grpc.TopFlightsParams for the detailed signature.

TopFlightsResult dataclass ¤

TopFlightsResult(
    request: RequestT, response: Response, timestamp: int
)

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 int
request RequestT
response Response

timestamp instance-attribute ¤

timestamp: int

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_proto ¤

to_proto() -> TopFlightsResponse

to_dict ¤

to_dict() -> dict[str, Any]

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

FlightDetailsService dataclass ¤

FlightDetailsService(__factory: ServiceFactory)

Bases: SupportsFetch[FlightDetailsParams]

Flight details service.

Methods:

Name Description
fetch

Fetch flight details.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> FlightDetailsResult

Fetch flight details. See fr24.grpc.FlightDetailsParams for the detailed signature.

FlightDetailsResult dataclass ¤

FlightDetailsResult(
    request: RequestT, response: Response, timestamp: int
)

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 int
request RequestT
response Response

timestamp instance-attribute ¤

timestamp: int

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_proto ¤

to_proto() -> FlightDetailsResponse

to_dict ¤

to_dict() -> dict[str, Any]

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None

PlaybackFlightService dataclass ¤

PlaybackFlightService(__factory: ServiceFactory)

Bases: SupportsFetch[PlaybackFlightParams]

Playback flight service.

Methods:

Name Description
fetch

Fetch playback flight details.

fetch async ¤

fetch(*args: Any, **kwargs: Any) -> PlaybackFlightResult

Fetch playback flight details. See fr24.grpc.PlaybackFlightParams for the detailed signature.

PlaybackFlightResult dataclass ¤

PlaybackFlightResult(request: RequestT, response: Response)

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

request instance-attribute ¤

request: RequestT

response instance-attribute ¤

response: Response

to_proto ¤

to_proto() -> PlaybackFlightResponse

to_dict ¤

to_dict() -> dict[str, Any]

to_polars ¤

to_polars() -> DataFrame

write_table ¤

write_table(
    file: WriteLocation,
    *,
    format: SupportedFormats = "parquet",
) -> None