API

These functions return information about the API.

async flightplandb.api.header_value(header_key: str, key: str | None = None) str

Gets header value for key. Do not call directly.

Parameters:
  • header_key (str) -- One of the HTTP header keys

  • key (str, optional) -- API authentication key.

Returns:

The value corresponding to the passed key

Return type:

str

async flightplandb.api.version(key: str | None = None) int

API version that returned the response.

Parameters:

key (str, optional) -- API authentication key.

Returns:

API version

Return type:

int

async flightplandb.api.units(key: str | None = None) str

The units system used for numeric values. https://flightplandatabase.com/dev/api#units

Parameters:

key (str, optional) -- API authentication key.

Returns:

AVIATION, METRIC or SI

Return type:

str

async flightplandb.api.limit_cap(key: str | None = None) int

The number of requests allowed per day, operated on an hourly rolling basis. i.e requests used between 19:00 and 20:00 will become available again at 19:00 the following day. API key authenticated requests get a higher daily rate limit and can be raised if a compelling use case is presented. See Request Limits for more details.

Parameters:

key (str, optional) -- API authentication key.

Returns:

number of allowed requests per day

Return type:

int

async flightplandb.api.limit_used(key: str | None = None) int

The number of requests used in the current period by the presented API key or IP address. See Request Limits for more details.

Parameters:

key (str, optional) -- API authentication key.

Returns:

number of requests used in period

Return type:

int

async flightplandb.api.ping(key: str | None = None) StatusResponse

Checks API status to see if it is up

Parameters:

key (str, optional) -- API authentication key.

Returns:

OK 200 means the service is up and running.

Return type:

StatusResponse

async flightplandb.api.revoke(key: str) StatusResponse

Revoke the API key in use in the event it is compromised. See Authentication for more details.

Requires authentication.

Parameters:

key (str) -- API authentication key.

Returns:

If the HTTP response code is 200 and the status message is "OK", then the key has been revoked and any further requests will be rejected. Any other status code or message indicates an error has occurred and the errors array will give further details.

Return type:

StatusResponse