Internal functions

This file mostly contains internal functions called by the API, so you're unlikely to ever use them.

async flightplandb.internal.request(method: str, path: str, return_format: Literal['native'] = 'native', ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) Tuple[CIMultiDictProxy[str], Dict[str, Any]]
async flightplandb.internal.request(method: str, path: str, return_format: Literal['pdf'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) Tuple[CIMultiDictProxy[str], bytes]
async flightplandb.internal.request(method: str, path: str, return_format: Literal['json', 'xml', 'csv', 'kml', 'xplane', 'xplane11', 'fs9', 'fsx', 'squawkbox', 'xfmc', 'pmdg', 'airbusx', 'qualitywings', 'ifly747', 'flightgear', 'tfdi717', 'infiniteflight'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) Tuple[CIMultiDictProxy[str], str]

General HTTP requests function for non-paginated results.

Parameters:
  • method (str) -- An HTTP request type. One of GET, POST, PATCH, or DELETE

  • path (str) -- The endpoint's path to which the request is being made

  • return_format (str, optional) -- The API response format, defaults to "native"

  • ignore_statuses (Tuple, optional) -- Statuses (together with 200 OK) which don't raise an HTTPError, defaults to None

  • params (Dict, optional) -- Any other HTTP request parameters, defaults to None

  • json_data (Dict, optional) -- Custom JSON data to be formatted into the request body

  • key (str) -- API token, defaults to None (which makes it unauthenticated)

Returns:

A tuple of:
1. A dict of the response headers, but the keys are case-insensitive
2. A Dict if return_format is "native", otherwise str or bytes depending on if the return format is UTF-8 or something else.

Return type:

Tuple[CIMultiDict, Union[Dict, str, bytes]]

Raises:
  • ValueError -- Invalid return_format option

  • HTTPError -- Invalid HTTP status in response

async flightplandb.internal.get_headers(key: str | None = None) CIMultiDictProxy[str]

Calls request() for request headers.

Parameters:

key (str, optional) -- API token, defaults to None (which makes it unauthenticated)

Returns:

A dict of the response headers, but the keys are case-insensitive.

Return type:

CIMultiDictProxy

async flightplandb.internal.get(path: str, return_format: Literal['native'] = 'native', ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, key: str | None = None) Dict[str, Any] | List[Any]
async flightplandb.internal.get(path: str, return_format: Literal['pdf'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, key: str | None = None) bytes
async flightplandb.internal.get(path: str, return_format: Literal['json', 'xml', 'csv', 'kml', 'xplane', 'xplane11', 'fs9', 'fsx', 'squawkbox', 'xfmc', 'pmdg', 'airbusx', 'qualitywings', 'ifly747', 'flightgear', 'tfdi717', 'infiniteflight'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, key: str | None = None) str

Calls request() for get requests.

Parameters:
  • path (str) -- The endpoint's path to which the request is being made

  • return_format (str, optional) -- The API response format, defaults to "native"

  • ignore_statuses (Tuple, optional) -- Statuses (together with 200 OK) which don't raise an HTTPError, defaults to None

  • params (Dict, optional) -- Any other HTTP request parameters, defaults to None

  • key (str, optional) -- API token, defaults to None (which makes it unauthenticated)

Returns:

A Dict if return_format is "native", otherwise str or bytes depending on if the return format is UTF-8 or something else.

Return type:

Union[Dict, bytes]

async flightplandb.internal.post(path: str, return_format: Literal['native'] = 'native', ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) Dict[str, Any]
async flightplandb.internal.post(path: str, return_format: Literal['pdf'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) bytes
async flightplandb.internal.post(path: str, return_format: Literal['json', 'xml', 'csv', 'kml', 'xplane', 'xplane11', 'fs9', 'fsx', 'squawkbox', 'xfmc', 'pmdg', 'airbusx', 'qualitywings', 'ifly747', 'flightgear', 'tfdi717', 'infiniteflight'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) str

Calls request() for post requests.

Parameters:
  • path (str) -- The endpoint's path to which the request is being made

  • return_format (str, optional) -- The API response format, defaults to "native"

  • ignore_statuses (Tuple, optional) -- Statuses (together with 200 OK) which don't raise an HTTPError, defaults to None

  • params (Dict, optional) -- Any other HTTP request parameters, defaults to None

  • json_data (Dict, optional) -- Custom JSON data to be formatted into the request body

  • key (str, optional) -- API token, defaults to None (which makes it unauthenticated)

Returns:

A Dict if return_format is "native", otherwise str or bytes depending on if the return format is UTF-8 or something else.

Return type:

Union[Dict, bytes]

async flightplandb.internal.patch(path: str, return_format: Literal['native'] = 'native', ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) Dict[str, Any]
async flightplandb.internal.patch(path: str, return_format: Literal['pdf'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) bytes
async flightplandb.internal.patch(path: str, return_format: Literal['json', 'xml', 'csv', 'kml', 'xplane', 'xplane11', 'fs9', 'fsx', 'squawkbox', 'xfmc', 'pmdg', 'airbusx', 'qualitywings', 'ifly747', 'flightgear', 'tfdi717', 'infiniteflight'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, json_data: Dict[str, Any] | None = None, key: str | None = None) str

Calls request() for patch requests.

Parameters:
  • path (str) -- The endpoint's path to which the request is being made

  • return_format (str, optional) -- The API response format, defaults to "native"

  • ignore_statuses (Tuple, optional) -- Statuses (together with 200 OK) which don't raise an HTTPError, defaults to None

  • params (Dict, optional) -- Any other HTTP request parameters, defaults to None

  • json_data (Dict, optional) -- Custom JSON data to be formatted into the request body

  • key (str, optional) -- API token, defaults to None (which makes it unauthenticated)

Returns:

A Dict if return_format is "native", otherwise str or bytes depending on if the return format is UTF-8 or something else.

Return type:

Union[Dict, bytes]

async flightplandb.internal.delete(path: str, return_format: Literal['native'] = 'native', ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, key: str | None = None) Dict[str, Any]
async flightplandb.internal.delete(path: str, return_format: Literal['pdf'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, key: str | None = None) bytes
async flightplandb.internal.delete(path: str, return_format: Literal['json', 'xml', 'csv', 'kml', 'xplane', 'xplane11', 'fs9', 'fsx', 'squawkbox', 'xfmc', 'pmdg', 'airbusx', 'qualitywings', 'ifly747', 'flightgear', 'tfdi717', 'infiniteflight'], ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, key: str | None = None) str

Calls request() for delete requests.

Parameters:
  • path (str) -- The endpoint's path to which the request is being made

  • return_format (str, optional) -- The API response format, defaults to "native"

  • ignore_statuses (Tuple, optional) -- Statuses (together with 200 OK) which don't raise an HTTPError, defaults to None

  • params (Dict, optional) -- Any other HTTP request parameters, defaults to None

  • key (str, optional) -- API token, defaults to None (which makes it unauthenticated)

Returns:

A Dict if return_format is "native", otherwise str or bytes depending on if the return format is UTF-8 or something else.

Return type:

Union[Dict, bytes]

async flightplandb.internal.getiter(path: str, limit: int = 100, sort: str = 'created', ignore_statuses: Tuple[int] | Tuple = (), params: Dict[str, Any] | None = None, key: str | None = None) AsyncIterable[Dict[str, Any]]

Get request() for paginated results.

Parameters:
  • path (str) -- The endpoint's path to which the request is being made

  • limit (int, optional) -- Maximum number of results to return, defaults to 100

  • sort (str, optional) -- Sort order to return results in. Valid sort orders are created, updated, popularity, and distance

  • ignore_statuses (Tuple, optional) -- Statuses (together with 200 OK) which don't raise an HTTPError, defaults to None

  • params (Dict, optional) -- Any other HTTP request parameters, defaults to None

  • key (str, optional) -- API token, defaults to None (which makes it unauthenticated)

Returns:

An iterable of dicts. Return format cannot be specified.

Return type:

AsyncIterable[Dict]