HafasResponse

class pyhafas.types.hafas_response.HafasResponse(raw_hafas_response, mapping)[source]

Bases: object

The class HafasResponse handles the general parsing and error-checking of a raw HaFAS response

Variables
  • raw_hafas_response (requests.Response) – The raw response of HaFAS

  • data (dict) – json parsed raw response of HaFAS

check_for_errors(mapping)[source]

Checks if HaFAS response has error messages and handles them

Parameters

mapping (ErrorCodesMappingInterface) – Error Mapping Enum (key is the HaFAS error code, value the error class)

property common

Returns the “common” data out of HaFAS data

Returns

dict with “common” data

property res

Returns the “res” data out of HaFAS data

Returns

dict with “res” data