def search_flights(): FLAG=0 try: source=input("Enter the source:") ViewValidations.validate_source(source) destination=input("Enter the destination:") ViewValidations.validate_destination(destination) time=input("Enter the time") list_of_flights=ViewValidations.validate_view(source,destination,time) if(list_of_flights!=None): FLAG=1; for flight in list_of_flights: print(flight.get_flight_id()," ",flight.get_flight_name()," ", flight.get_departure_time()," ", flight.get_adult_fare()," ",flight.get_child_fare(), flight.get_duration()) print() choice=input("Do you wish to continue booking? Enter 'Y' or 'N' ") if(choice=="Y"): flightid=input("Enter the flight Id") flight_booking.flight_booking(flightid) except CustomExceptions.InvalidSourceException as e: print(e) except CustomExceptions.InvalidDestinationException as e: print(e) except CustomExceptions.InvalidTimeException as e: print(e) except CustomExceptions.NoFlightFoundException as e: print(e) except Exception as e: print(e) finally: if(FLAG==0): search_flights()
def search_advance(): try: p_source=input("Enter the source:") ViewValidations.validate_source(p_source) p_destination=input("Enter the Destination:") ViewValidations.validate_destination(p_destination) print("Available options are:\n") print("=====================") res1=get_flight_with1Hop(p_source,p_destination) res2=get_flight_with2Hop(p_source,p_destination) if(res1==False and res2==False): print("No option") except CustomExceptions.InvalidSourceException as e: print(e) except CustomExceptions.InvalidDestinationException as e: print(e)