Core

Warning

The functionality provided by the fseconomy.core module is reserved for internal purposes. It does not constitute an API intended for public use. This documentation is solely provided for the sake of completeness, and to support developers contributing to the fseconomy package.

API

fseconomy.core.api.API_VERSIONS = {'data': 'https://server.fseconomy.net/data', 'fse': 'https://server.fseconomy.net/rest/fse/api', 'static': 'https://server.fseconomy.net/static', 'v1': 'https://server.fseconomy.net/rest/api', 'v2': 'https://server.fseconomy.net/rest/api/v2'}

FSEconomy APIs and versions

fseconomy.core.api.MAINTENANCE = 'Currently Closed for Maintenance'

Server maintenance token string

fseconomy.core.api.DATA_FEEDS = {'aircraft aliases': {'decode': <function decode>, 'query': 'aircraft', 'rakey': False, 'search': 'aliases'}, 'aircraft by id': {'decode': <function decode>, 'params': ['serialnumber'], 'query': 'aircraft', 'rakey': False, 'search': 'serialnumber'}, 'aircraft by key': {'decode': <function decode>, 'query': 'aircraft', 'rakey': True, 'search': 'key'}, 'aircraft by makemodel': {'decode': <function decode>, 'params': ['makemodel'], 'query': 'aircraft', 'rakey': False, 'search': 'makemodel'}, 'aircraft by ownername': {'decode': <function decode>, 'params': ['ownername'], 'query': 'aircraft', 'rakey': False, 'search': 'ownername'}, 'aircraft by registration': {'decode': <function decode>, 'params': ['aircraftreg'], 'query': 'aircraft', 'rakey': False, 'search': 'registration'}, 'aircraft configs': {'decode': <function decode>, 'query': 'aircraft', 'rakey': False, 'search': 'configs'}, 'aircraft for sale': {'decode': <function decode>, 'query': 'aircraft', 'rakey': False, 'search': 'forsale'}, 'aircraft status by registration': {'decode': <function decode>, 'params': ['aircraftreg'], 'query': 'aircraft', 'rakey': False, 'search': 'status'}, 'assignments by key': {'decode': <function decode>, 'query': 'assignments', 'rakey': True, 'search': 'key'}, 'commodities by key': {'decode': <function decode>, 'query': 'commodities', 'rakey': True, 'search': 'key'}, 'facilities by key': {'decode': <function decode>, 'query': 'Facilities', 'rakey': True, 'search': 'key'}, 'fbo monthly summary by icao': {'decode': <function decode>, 'params': ['month', 'year', 'icao'], 'query': 'fbos', 'rakey': True, 'search': 'monthlysummary'}, 'fbos by key': {'decode': <function decode>, 'query': 'fbos', 'rakey': True, 'search': 'key'}, 'fbos for sale': {'decode': <function decode>, 'query': 'fbos', 'rakey': False, 'search': 'forsale'}, 'flight logs by key from id': {'decode': <function decode>, 'params': ['fromid'], 'query': 'flightlogs', 'rakey': True, 'search': 'id'}, 'flight logs by key from id for all group aircraft': {'decode': <function decode>, 'params': ['fromid', 'type'], 'query': 'flightlogs', 'rakey': True, 'search': 'id'}, 'flight logs by key month year': {'decode': <function decode>, 'params': ['month', 'year'], 'query': 'flightlogs', 'rakey': True, 'search': 'monthyear'}, 'flight logs by reg from id': {'decode': <function decode>, 'params': ['fromid', 'aircraftreg'], 'query': 'flightlogs', 'rakey': False, 'search': 'id'}, 'flight logs by reg month year': {'decode': <function decode>, 'params': ['aircraftreg', 'month', 'year'], 'query': 'flightlogs', 'rakey': False, 'search': 'monthyear'}, 'flight logs by serialnumber from id': {'decode': <function decode>, 'params': ['fromid', 'serialnumber'], 'query': 'flightlogs', 'rakey': False, 'search': 'id'}, 'flight logs by serialnumber month year': {'decode': <function decode>, 'params': ['serialnumber', 'month', 'year'], 'query': 'flightlogs', 'rakey': False, 'search': 'monthyear'}, 'group members': {'decode': <function decode>, 'query': 'group', 'rakey': True, 'search': 'members'}}

FSEconomy Data Feeds with their respective parameters and parser function

Fetch Data Feed

fseconomy.core.fetch.fetch(feed: str, params: dict | None = None) None | Response

Fetch data feed and parse response

The feed parameter needs to represent a data feed as defined in the api module.

If the requested feed requires additional parameters, these need to be provided via the params dictionary.

Raises:
Parameters:
  • feed (str) – the data feed to fetch

  • params (dict) – optional dictionary with additional parameters specific to the requested data feed

Returns:

FSEconomy Server Response object

Return type:

Response

Keys

fseconomy.core.keys.ACCESS_KEY: str | None = None

FSEconomy Access Key

fseconomy.core.keys.SERVICE_KEY: str | None = None

FSEconomy Service Key

fseconomy.core.keys.USER_KEY: str | None = None

FSEconomy User Key

fseconomy.core.keys.validate_key(key: str | None) bool

validates a new style FSEconomy API key

Parameters:

key (str) – string to validate

Returns:

True if string is a valid API key, otherwise False

fseconomy.core.keys.get_data_keys() dict[str, str]

get keys to query an FSEconomy data feed

This function uses a set of rules to deliver a valid result even if not all keys are set:

  • If available, the service key is preferred over the (personal) user key.

  • If no access key has been defined, the user key is used as default.

The function must be able to establish an authentication key (user or service key), and a data access key (read access or user key). In case of a failure, it raises either an FseDataKeyError or an FseAuthKeyError.

Raises:
Returns:

dictionary with keys

Return type:

dict[str, str]

Data Decoders

Collection of data decoding functions to convert the raw XML data received from the FSEconomy server into standard Python data types

Aircraft Status

fseconomy.core.data.status.decode(raw_data: str) list[dict[str, int | str]]

Decode FSEconomy aircraft status data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing an aircraft data feed

Returns:

list of dictionaries representing each an aircraft configuration from the data feed

Return type:

list[dict]

fseconomy.core.data.status.__decode_status(status: dict[str, str]) dict[str, int | str]

Private function to decode data representing one single aircraft status

Parameters:

status (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with aircraft configuration information decoded into native Python data types

Return type:

dict

Aircraft Configuration

fseconomy.core.data.config.decode(raw_data: str) list[dict[str, float | int | str]]

Decode FSEconomy aircraft configuration data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing an aircraft data feed

Returns:

list of dictionaries representing each an aircraft configuration from the data feed

Return type:

list[dict]

fseconomy.core.data.config.__decode_config(config: dict[str, str]) dict[str, float | int | str]

Private function to decode data representing one single aircraft configuration

Parameters:

config (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with aircraft configuration information decoded into native Python data types

Return type:

dict

Aircraft Aliases

fseconomy.core.data.aliases.decode(raw_data: str) list[dict[str, str | list[str]]]

Decode FSEconomy aircraft alias data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing an aircraft data feed

Returns:

list of dictionaries representing each an aircraft alias set from the data feed

Return type:

list[dict]

fseconomy.core.data.aliases.__decode_aliases(aircraft_alias: dict[str, str]) dict[str, str | list[str]]

Private function to decode data representing one single aircraft alias set

Parameters:

aircraft_alias (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with aircraft alias information decoded into native Python data types

Return type:

dict

Aircraft

fseconomy.core.data.aircraft.decode(raw_data: str) list[dict[str, bool | int | float | str]]

Decode FSEconomy aircraft data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing an aircraft data feed

Returns:

list of dictionaries representing each an aircraft from the data feed

Return type:

list[dict]

fseconomy.core.data.aircraft.__decode_aircraft(aircraft: dict[str, str]) dict[str, bool | float | int | str]

Private function to decode data representing one single aircraft

Parameters:

aircraft (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with aircraft information decoded into native Python data types

Return type:

dict

Assignments

fseconomy.core.data.assignment.decode(raw_data: str) list[dict[str, bool | datetime | float | int | str]]

Decode FSEconomy aircraft configuration data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing an aircraft data feed

Returns:

list of dictionaries representing each an aircraft configuration from the data feed

Return type:

list[dict]

fseconomy.core.data.assignment.__decode_assignment(assignment: dict[str, str]) dict[str, bool | datetime | float | int | str]

Private function to decode data representing one single assignment

Parameters:

assignment (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with assignment information decoded into native Python data types

Return type:

dict

Commodities

fseconomy.core.data.commodity.decode(raw_data: str) list[dict[str, int | str]]

Decode FSEconomy commodity data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing a commodity data feed

Returns:

list of dictionaries representing each a commodity from the data feed

Return type:

list[dict]

fseconomy.core.data.commodity.__decode_commodity(commodity: dict[str, str]) dict[str, int | str]

Private function to decode data representing one single assignment

Parameters:

commodity (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with commodity information decoded into native Python data types

Return type:

dict

Facilities

fseconomy.core.data.facility.decode(raw_data: str) list[dict[str, bool | int | str]]

Decode FSEconomy facility data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing a facility data feed

Returns:

list of dictionaries representing each a facility from the data feed

Return type:

list[dict]

fseconomy.core.data.facility.__decode_facility(facility: dict[str, str]) dict[str, bool | int | str]

Private function to decode data representing one single facility

Parameters:

facility (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with facility information decoded into native Python data types

Return type:

dict

FBOs

fseconomy.core.data.fbo.decode(raw_data: str) list[dict[str, bool | float | int | str]]

Decode FSEconomy FBO data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing an FBO data feed

Returns:

list of dictionaries representing each an FBO from the data feed

Return type:

list[dict]

fseconomy.core.data.fbo.__decode_fbo(fbo: dict[str, str]) dict[str, bool | float | int | str]

Private function to decode data representing one single FBO

Parameters:

fbo (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with fbo information decoded into native Python data types

Return type:

dict

FBO Summary

fseconomy.core.data.summary.decode(raw_data: str) list[dict[str, float | int | str]]

Decode FSEconomy FBO monthly summary data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing an FBO monthly summary data feed

Returns:

list of dictionaries representing each an FBO monthly summary from the data feed

Return type:

list[dict]

fseconomy.core.data.summary.__decode_summary(summary: dict[str, str]) dict[str, float | int | str]

Private function to decode data representing one single FBO monthly summary

Parameters:

summary (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with FBO monthly summary information decoded into native Python data types

Return type:

dict

Flights

fseconomy.core.data.flight.decode(raw_data: str) list[dict[str, bool | float | int | str]]

Decode FSEconomy flight data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (str) – string with raw XML data representing a flight log data feed

Returns:

list of dictionaries representing each a flight log entry from the data feed

Return type:

list[dict]

fseconomy.core.data.flight.__decode_flight(flight: dict[str, str]) dict[str, bool | float | int | str]

Private function to decode data representing one single FBO

Parameters:

flight (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with flight information decoded into native Python data types

Return type:

dict

Group Members

fseconomy.core.data.member.decode(raw_data: str) list[dict[str, bool | float | int | str]]

Decode FSEconomy member data

Raises:
Parameters:

raw_data (str) – string with raw XML data representing a group member data feed

Returns:

list of dictionaries representing each a group member entry from the data feed

Return type:

list[dict]

fseconomy.core.data.member.__decode_member(member: dict[str, str]) dict[str, bool | float | int | str]

Private function to decode data representing one single FBO

Parameters:

member (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with member information decoded into native Python data types

Return type:

dict

Airports

fseconomy.core.data.airport.decode(raw_data: bytes) list[dict[str, int | float | str]]

Decode FSEconomy airport data

Raises:

FseDataParseError – in case of malformed data provided

Parameters:

raw_data (bytes) – string with raw byte data representing airport data as csv file

Returns:

list of dictionaries representing each an airport from the data feed

Return type:

list[dict]

fseconomy.core.data.airport.__decode_airport(airport: dict[str, str]) dict[str, float | int | str]

Private function to decode data representing one single airport

Parameters:

airport (dict) – Python dictionary derived from FSEconomy server XML output

Returns:

dictionary with airport information decoded into native Python data types

Return type:

dict