Example #1
0
 def get_ow():
     ow = Oneworld()
     ow_data = ow.get_all_data()
     return ow_data
 def get_ow():
     ow = Oneworld()
     ow_data = ow.get_all_data()
     return ow_data
Example #3
0
                    help='Enable information logging while searching')
parser.add_argument('--directonly',
                    default=False,
                    action="store_true",
                    help='Only return direct flights')

args = vars(parser.parse_args())

# download data sources
#ad = AllData()
#data = ad.get_data()

to = args['to']
if to is None:
    # Destination airport is blank, so return a list of flights from the departure city
    ow = Oneworld()

    try:
        destinations = set()
        routes = ow.get_uniq_routes(args['from'])
        for src in routes.keys():
            for dst in routes[src]:
                destinations.add(dst)
        to = ",".join(destinations)
    except Exception as e:
        logging.error("There was an error running the search: {0}".format(
            traceback.format_exc()))

ba = BA2(debug=args['debug'], info=args['info'])
try:
    results = ba.lookup_dates(args['from'], to, args['dates'], args['class'],
                   help='Class of travel, as a fare code such as Y, W, J, F or name like economy, premium, business, first')
parser.add_argument('adults', type=str, action="store", help='Number of adults')
parser.add_argument('--debug', default=False, action="store_true", help='Enable very verbose logging')
parser.add_argument('--info', default=False, action="store_true", help='Enable information logging while searching')
parser.add_argument('--directonly', default=False, action="store_true", help='Only return direct flights')

args = vars(parser.parse_args())

# download data sources
#ad = AllData()
#data = ad.get_data()

to = args['to']
if to is None:
    # Destination airport is blank, so return a list of flights from the departure city
    ow = Oneworld()

    try:
        destinations = set()
        routes = ow.get_uniq_routes(args['from'])
        for src in routes.keys():
            for dst in routes[src]:
                destinations.add(dst)
        to = ",".join(destinations)
    except Exception as e:
        logging.error("There was an error running the search: {0}".format(traceback.format_exc()))

ba = BA2(debug=args['debug'], info=args['info'])
try:
    results = ba.lookup_dates(args['from'], to, args['dates'], args['class'], args['adults'], args['directonly'])
    formatted = ba.format_results(results)