def get_airports_by_bbox(bbox): if not isinstance(bbox, Bounds): raise TypeError('Invalid `bbox` parameter.') bbox.normalize() if bbox.get_size() > 20 * 20: raise ValueError('Requested `bbox` is too large.') return map(airport_to_dict, Airport.by_bbox(bbox))
def get_airports_by_bbox(bbox): if not isinstance(bbox, Bounds): raise TypeError('Invalid `bbox` parameter.') bbox.normalize() if bbox.get_size() > 20 * 20: raise ValueError('Requested `bbox` is too large.') data, errors = airport_list_schema.dump(Airport.by_bbox(bbox), many=True) return data
def get_airports_by_bbox(bbox): if not isinstance(bbox, Bounds): raise TypeError("Invalid `bbox` parameter.") bbox.normalize() if bbox.get_size() > 20 * 20: raise ValueError("Requested `bbox` is too large.") data, errors = airport_list_schema.dump(Airport.by_bbox(bbox), many=True) return data
def airports(): bbox = request.args.get('bbox', type=Bounds.from_bbox_string) if not bbox: raise BadRequest('Invalid `bbox` parameter.') bbox.normalize() if bbox.get_size() > 20 * 20: raise BadRequest('Requested `bbox` is too large.') airports = map(airport_to_json, Airport.by_bbox(bbox)) return jsonify(airports=airports)