Example #1
0
def generate_airport_factory():
    airports_xml = download_airport_xml()
    airports = AirPortParser.parse_airports(airports_xml)
    airport_factory = AirPortFactory(airports)
    return airport_factory
 def testRealisticData(self):
     xml_data = open("testdata/airportNames.xml").read()
     
     airports = AirPortParser.parse_airports(xml_data)
     self.assertEqual(1932, len(airports))
Example #3
0
)
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)

flights = FlightParser.parse_flights(xml, airline_factory, airport_factory, status_factory)