def get_airport(id, context): if os.environ["DATABASE"] == "janus": data = janus_service.get_airport_from_janus(id, context) else: raise database_not_found.DatabaseNotFoundException( os.environ["DATABASE"]) return data
def get_airports(city, country, code, context): if os.environ["DATABASE"] == "janus": data = janus_service.get_airports_from_janus(capitalize(city), capitalize(country), upper(code), context) else: raise database_not_found.DatabaseNotFoundException( os.environ["DATABASE"]) return data
def get_filter_list(filter): if filter not in filter_types: raise tag_not_found.TagNotFounException(filter) if filter == "type": return ["non-stop", "one-stop", "two-stop"] if os.environ["DATABASE"] == "janus": return janus_service.get_flight_info_from_janus(filter) else: raise database_not_found.DatabaseNotFoundException( os.environ["DATABASE"])
def get_onestop_flights(from_, to, filters, context): if filters["date_to"] - filters["date_from"] < timedelta(0): raise illegal_date.IllegalDateException( "from date can not be greater than to date") if os.environ["DATABASE"] == "janus": flights = janus_service.get_onestop_flights_from_janus( from_, to, context) else: raise database_not_found.DatabaseNotFoundException( os.environ["DATABASE"]) return update_cost(flights, filters["date_from"], 0.75)