Utilities
Mostly used in the service.
utils
¤
Classes:
Name | Description |
---|---|
BarePath |
A path to a file without an extension. |
SupportsToDict |
|
SupportsToPolars |
|
Ok |
|
Err |
|
UnwrapError |
|
Functions:
Name | Description |
---|---|
to_unix_timestamp |
Casts timestamp-like object to a Unix timestamp in integer seconds, |
get_current_timestamp |
Returns the current Unix timestamp in seconds. |
parse_server_timestamp |
|
to_flight_id |
|
format_bare_path |
|
write_table |
Writes the table as the specified format via polars. |
scan_table |
Reads the table as the specified format via polars. |
intercept_logs_with_loguru |
Intercepts stdlib logging to stderr with loguru. |
Attributes:
Name | Type | Description |
---|---|---|
DEFAULT_HEADERS |
|
|
IntoTimestamp |
TypeAlias
|
Unix timestamp in seconds or a datetime object. |
IntoFlightId |
TypeAlias
|
|
SupportedFormats |
TypeAlias
|
|
DictT_co |
The dictionary representation of an object, e.g. |
|
T |
|
|
E |
|
|
Result |
TypeAlias
|
A type that represents either success ( |
DEFAULT_HEADERS
module-attribute
¤
DEFAULT_HEADERS = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate, br",
"Origin": "https://www.flightradar24.com",
"Connection": "keep-alive",
"Referer": "https://www.flightradar24.com/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
"TE": "trailers",
}
IntoTimestamp
module-attribute
¤
Unix timestamp in seconds or a datetime object.
DictT_co
module-attribute
¤
DictT_co = TypeVar('DictT_co', covariant=True)
The dictionary representation of an object, e.g. TypedDict
.
Result
module-attribute
¤
A type that represents either success (Ok
) or failure (Err
).
SupportsToDict
¤
SupportsToPolars
¤
Ok
dataclass
¤
Ok(_value: T)
Err
dataclass
¤
Err(_value: E)
UnwrapError
¤
to_unix_timestamp
¤
to_unix_timestamp(
timestamp: IntoTimestamp | str | Literal["now"] | None,
) -> int | Literal["now"] | None
Casts timestamp-like object to a Unix timestamp in integer seconds,
returning None
if timestamp
is None
.
get_current_timestamp
¤
get_current_timestamp() -> int
Returns the current Unix timestamp in seconds.
write_table
¤
write_table(
result: SupportsToPolars,
file: str | Path | IO[bytes] | BarePath,
*,
format: SupportedFormats = "parquet",
**kwargs: Any,
) -> None
scan_table
¤
scan_table(
file: Path | IO[bytes] | BarePath,
*,
format: SupportedFormats = "parquet",
) -> LazyFrame