Example #1
0
def get_flights(airport, airline_factory, airport_factory, status_factory):
    query = Query(airport)
    xml = FlightInformationService.download_flight_xml(query)
    return FlightParser.parse_flights(xml, airline_factory, airport_factory,
                                      status_factory)
Example #2
0
def download_airline_xml():
    return FlightInformationService.download_airline_xml()
Example #3
0
def download_status_xml():
    return FlightInformationService.download_flight_status_xml()
Example #4
0
    default=False,
)
parser.add_option(
    "--arrivals",
    action="store_true",
    dest="arrivals_only",
    help="Print information about only arrivals.",
    default=False,
)


(options, args) = parser.parse_args()
airportname = args[0]


airports_xml = FlightInformationService.download_airport_xml()
airports = AirPortParser.parse_airports(airports_xml)
airport_factory = AirPortFactory(airports)

airlines_xml = FlightInformationService.download_airline_xml()
airlines = AirlineParser.parse_airlines(airlines_xml)
airline_factory = AirlineFactory(airlines)

status_xml = FlightInformationService.download_flight_status_xml()
statuses = FlightStatusParser.parse_statuses(status_xml)
status_factory = FlightStatusFactory(statuses)

airport = airport_factory.get_airport_by_code(airportname)
query = Query(airport)
xml = FlightInformationService.download_flight_xml(query)
 def testDirectionArrivalQueryString(self):
     self.query.direction = Flight.Directions.ARRIVAL
     v = FlightInformationService.generate_query_string(self.query)
     self.assertEqual(v, "airport=OSL&direction=A")
 def testDirectionDepartureQueryString(self):
     self.query.direction = Flight.Directions.DEPARTURE
     v = FlightInformationService.generate_query_string(self.query)
     self.assertEqual(v, "airport=OSL&direction=D")
 def testTimeBoxQueryString(self):
     self.query.time_to = 3
     v = FlightInformationService.generate_query_string(self.query)
     self.assertEqual(v, "airport=OSL&timeTo=3")
 def testSimpleQueryString(self):
     v = FlightInformationService.generate_query_string(self.query)
     self.assertEqual(v, "airport=OSL")