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
apimodule.If the requested feed requires additional parameters, these need to be provided via the
paramsdictionary.- Raises:
FseDataFeedInvalidError – in case
feedis not a valid data feedFseDataFeedParamError – in case a required additional parameter is missing
FseServerRequestError – in case the communication with the server fails
FseServerMaintenanceError – in case the server is in maintenance mode
FseDataParseError – in case the data received are malformed or cannot be parsed for other reasons
- Parameters:
- Returns:
FSEconomy Server Response object
- Return type:
Keys
- 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
FseDataKeyErroror anFseAuthKeyError.- Raises:
FseDataKeyError – if no valid data key can be established
FseAuthKeyError – if no valid auth key can be established
- Returns:
dictionary with keys
- Return type:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
Group Members
- fseconomy.core.data.member.decode(raw_data: str) list[dict[str, bool | float | int | str]]
Decode FSEconomy member data
- Raises:
FseDataParseError – in case of malformed data provided
FseDataKeyError – in case of invalid data key provided
- 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:
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: