def __init__(self): ResourceUri.__init__(self) self.parsers = {} self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] parser_get.add_argument("depth", type=int, default=1) parser_get.add_argument("count", type=int, default=10, description="Number of calendars per page") parser_get.add_argument("start_page", type=int, default=0, description="The current page") parser_get.add_argument("start_date", type=str, default="", description="Start date") parser_get.add_argument("end_date", type=str, default="", description="End date") parser_get.add_argument("forbidden_id[]", type=unicode, description="forbidden ids", dest="forbidden_uris[]", action="append")
def __init__(self): ResourceUri.__init__(self) self.parsers = {} self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] parser_get.add_argument("depth", type=int, default=1) parser_get.add_argument("count", type=int, default=10, description="Number of disruptions per page") parser_get.add_argument("start_page", type=int, default=0, description="The current page") parser_get.add_argument( "_current_datetime", type=date_time_format, default=datetime.utcnow(), description="The datetime we want to publish the disruptions from." " Default is the current date and it is mainly used for debug.") parser_get.add_argument("forbidden_id[]", type=unicode, description="forbidden ids", dest="forbidden_uris[]", action="append") parser_get.add_argument( "distance", type=int, default=200, description= "Distance range of the query. Used only if a coord is in the query" )
def __init__(self, *args, **kwargs): ResourceUri.__init__(self, *args, **kwargs) self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] self.parsers["get"].add_argument( "type[]", type=str, action="append", default=["stop_area", "stop_point", "poi"], description="Type of the objects to\ return") self.parsers["get"].add_argument("filter", type=str, default="", description="Filter your objects") self.parsers["get"].add_argument("distance", type=int, default=500, description="Distance range of the\ query") self.parsers["get"].add_argument("count", type=int, default=10, description="Elements per page") self.parsers["get"].add_argument("depth", type=depth_argument, default=1, description="Maximum depth on\ objects") self.parsers["get"].add_argument("start_page", type=int, default=0, description="The page number of the\ ptref result")
def __init__(self, is_collection, collection, *args, **kwargs): kwargs['authentication'] = False ResourceUri.__init__(self, *args, **kwargs) self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser = self.parsers["get"] parser.add_argument("start_page", type=int, default=0, description="The page where you want to start") parser.add_argument("count", type=int, default=25, description="Number of objects you want on a page") parser.add_argument("depth", type=depth_argument, default=1, description="The depth of your object") parser.add_argument("forbidden_id[]", type=unicode, description="forbidden ids", dest="forbidden_uris[]", action="append") parser.add_argument("external_code", type=unicode, description="An external code to query") parser.add_argument("show_codes", type=boolean, default=False, description="show more identification codes") parser.add_argument("odt_level", type=option_value(odt_levels), default="all", description="odt level") if is_collection: parser.add_argument("filter", type=str, default="", description="The filter parameter") self.collection = collection self.method_decorators.insert(0, ManageError())
def __init__(self, *args, **kwargs): ResourceUri.__init__(self, authentication=False, *args, **kwargs) self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) self.parsers["get"].add_argument("q", type=unicode, required=True, description="The data to search") self.parsers["get"].add_argument( "type[]", type=str, action="append", default=["stop_area", "address", "poi", "administrative_region"], description="The type of data to\ search") self.parsers["get"].add_argument("count", type=int, default=10, description="The maximum number of\ places returned") self.parsers["get"].add_argument("search_type", type=int, default=0, description="Type of search:\ firstletter or type error") self.parsers["get"].add_argument("admin_uri[]", type=str, action="append", description="If filled, will\ restrained the search within the\ given admin uris") self.parsers["get"].add_argument("depth", type=depth_argument, default=1, description="The depth of objects")
def __init__(self): ResourceUri.__init__(self) self.parsers = {} self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] parser_get.add_argument("depth", type=int, default=1) parser_get.add_argument("count", type=int, default=10, description="Number of disruptions per page") parser_get.add_argument("start_page", type=int, default=0, description="The current page") parser_get.add_argument( "_current_datetime", type=date_time_format, default=datetime.utcnow(), description="The datetime we want to publish the disruptions from." " Default is the current date and it is mainly used for debug.") parser_get.add_argument("forbidden_id[]", type=unicode, description="forbidden ids", dest="forbidden_uris[]", action="append") parser_get.add_argument( "_use_old_disruptions", type=bool, description="temporary boolean to use the old disruption interface. " "Will be deleted soon, just needed for synchronization with the front end", default=True)
def __init__(self): ResourceUri.__init__(self) self.parsers = {} self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] parser_get.add_argument("depth", type=int, default=1) parser_get.add_argument("count", type=int, default=10, description="Number of disruptions per page") parser_get.add_argument("start_page", type=int, default=0, description="The current page") parser_get.add_argument("period", type=int, default=365, description="Period from datetime") parser_get.add_argument("datetime", type=str, description="The datetime from which you want\ the disruption") parser_get.add_argument("forbidden_id[]", type=unicode, description="forbidden ids", dest="forbidden_uris[]", action="append")
def __init__(self, *args, **kwargs): ResourceUri.__init__(self, *args, **kwargs) self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) self.parsers["get"].add_argument("q", type=unicode, required=True, description="The data to search") self.parsers["get"].add_argument( "type[]", type=option_value(pt_object_type_values), action="append", default=pt_object_type_values, description="The type of data to\ search") self.parsers["get"].add_argument("count", type=int, default=10, description="The maximum number of\ ptobjects returned") self.parsers["get"].add_argument("search_type", type=int, default=0, description="Type of search:\ firstletter or type error") self.parsers["get"].add_argument("admin_uri[]", type=str, action="append", description="If filled, will\ restrained the search within the\ given admin uris") self.parsers["get"].add_argument("depth", type=depth_argument, default=1, description="The depth of objects")
def __init__(self, is_collection, collection, *args, **kwargs): kwargs['authentication'] = False ResourceUri.__init__(self, *args, **kwargs) self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser = self.parsers["get"] parser.add_argument("start_page", type=int, default=0, description="The page where you want to start") parser.add_argument("count", type=int, default=25, description="Number of objects you want on a page") parser.add_argument("depth", type=depth_argument, default=1, description="The depth of your object") parser.add_argument("forbidden_id[]", type=unicode, description="forbidden ids", dest="forbidden_uris[]", action="append") parser.add_argument("external_code", type=unicode, description="An external code to query") parser.add_argument("show_codes", type=boolean, default=False, description="show more identification codes") parser.add_argument("odt_level", type=option_value(odt_levels), default="all", description="odt level") parser.add_argument( "_current_datetime", type=date_time_format, default=datetime.utcnow(), description= "The datetime used to consider the state of the pt object" " Default is the current date and it is used for debug." " Note: it will mainly change the disruptions that concern the object" " The timezone should be specified in the format," " else we consider it as UTC") parser.add_argument( "distance", type=int, default=200, description= "Distance range of the query. Used only if a coord is in the query" ) if is_collection: parser.add_argument("filter", type=str, default="", description="The filter parameter") self.collection = collection self.method_decorators.insert(0, ManageError())
def __init__(self, *args, **kwargs): ResourceUri.__init__(self, *args, **kwargs) self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) self.parsers["get"].add_argument("q", type=unicode, required=True, description="The data to search") self.parsers["get"].add_argument( "type[]", type=option_value(pt_object_type_values), action="append", default=pt_object_type_values, description="The type of data to\ search") self.parsers["get"].add_argument("count", type=int, default=10, description="The maximum number of\ ptobjects returned") self.parsers["get"].add_argument("search_type", type=int, default=0, description="Type of search:\ firstletter or type error") self.parsers["get"].add_argument("admin_uri[]", type=str, action="append", description="If filled, will\ restrained the search within the\ given admin uris") self.parsers["get"].add_argument("depth", type=depth_argument, default=1, description="The depth of objects") self.parsers["get"].add_argument( "_use_old_disruptions", type=bool, description="temporary boolean to use the old disruption interface. " "Will be deleted soon, just needed for synchronization with the front end", default=False)
def __init__(self, endpoint): ResourceUri.__init__(self) ResourceUtc.__init__(self) self.endpoint = endpoint self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] parser_get.add_argument("filter", type=str) parser_get.add_argument("from_datetime", type=date_time_format, description="The datetime from which you want\ the schedules", default=None) parser_get.add_argument("until_datetime", type=date_time_format, description="The datetime until which you want\ the schedules", default=None) parser_get.add_argument("duration", type=int, default=3600 * 24, description="Maximum duration between datetime\ and the retrieved stop time") parser_get.add_argument("depth", type=int, default=2) parser_get.add_argument("count", type=int, default=10, description="Number of schedules per page") parser_get.add_argument("start_page", type=int, default=0, description="The current page") parser_get.add_argument("max_date_times", type=natural, default=10000, description="Maximum number of schedule per\ stop_point/route") parser_get.add_argument("forbidden_id[]", type=unicode, description="forbidden ids", dest="forbidden_uris[]", action="append") parser_get.add_argument("calendar", type=str, description="Id of the calendar") parser_get.add_argument("show_codes", type=boolean, default=False, description="show more identification codes") parser_get.add_argument( "_use_old_disruptions", type=bool, description="temporary boolean to use the old disruption interface. " "Will be deleted soon, just needed for synchronization with the front end", default=False) parser_get.add_argument( "_current_datetime", type=date_time_format, default=datetime.datetime.utcnow(), description="The datetime we want to publish the disruptions from." " Default is the current date and it is mainly used for debug.") self.method_decorators.append(complete_links(self))
def __init__(self): # journeys must have a custom authentication process ResourceUri.__init__(self, authentication=False) modes = ["walking", "car", "bike", "bss"] types = { "all": "All types", "best": "The best journey", "rapid": "A good trade off between duration, changes and constraint respect", 'no_train': "Journey without train", 'comfort': "A journey with less changes and walking", 'car': "A journey with car to get to the public transport", 'less_fallback_walk': "A journey with less walking", 'less_fallback_bike': "A journey with less biking", 'less_fallback_bss': "A journey with less bss", 'fastest': "A journey with minimum duration", 'non_pt_walk': "A journey without public transport, only walking", 'non_pt_bike': "A journey without public transport, only biking", 'non_pt_bss': "A journey without public transport, only bike sharing", } self.parsers = {} self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] parser_get.add_argument("from", type=str, dest="origin") parser_get.add_argument("to", type=str, dest="destination") parser_get.add_argument("datetime", type=str) parser_get.add_argument("datetime_represents", dest="clockwise", type=dt_represents, default=True) parser_get.add_argument("max_nb_transfers", type=int, default=10, dest="max_transfers") parser_get.add_argument("first_section_mode[]", type=option_value(modes), default=["walking"], dest="origin_mode", action="append") parser_get.add_argument("last_section_mode[]", type=option_value(modes), default=["walking"], dest="destination_mode", action="append") parser_get.add_argument("max_duration_to_pt", type=int, default=15 * 60, description="maximal duration of non public \ transport in second") parser_get.add_argument("walking_speed", type=float, default=1.12) parser_get.add_argument("bike_speed", type=float, default=4.1) parser_get.add_argument( "bss_speed", type=float, default=4.1, ) parser_get.add_argument("car_speed", type=float, default=16.8) parser_get.add_argument("forbidden_uris[]", type=str, action="append") parser_get.add_argument("count", type=int) parser_get.add_argument("min_nb_journeys", type=int) parser_get.add_argument("max_nb_journeys", type=int) parser_get.add_argument("type", type=option_value(types), default="all") parser_get.add_argument("disruption_active", type=boolean, default=False) # a supprimer parser_get.add_argument("max_duration", type=int, default=3600 * 24) parser_get.add_argument("wheelchair", type=boolean, default=False) parser_get.add_argument("debug", type=boolean, default=False, hidden=True) # for retrocompatibility purpose, we duplicate (without []): parser_get.add_argument("first_section_mode", type=option_value(modes), action="append") parser_get.add_argument("last_section_mode", type=option_value(modes), action="append") parser_get.add_argument("show_codes", type=boolean, default=False, description="show more identification codes") self.method_decorators.append(complete_links(self)) self.method_decorators.append(update_journeys_status(self))
def __init__(self): # journeys must have a custom authentication process ResourceUri.__init__(self, authentication=False) ResourceUtc.__init__(self) modes = ["walking", "car", "bike", "bss"] types = { "all": "All types", "best": "The best journey", "rapid": "A good trade off between duration, changes and constraint respect", 'no_train': "Journey without train", 'comfort': "A journey with less changes and walking", 'car': "A journey with car to get to the public transport", 'less_fallback_walk': "A journey with less walking", 'less_fallback_bike': "A journey with less biking", 'less_fallback_bss': "A journey with less bss", 'fastest': "A journey with minimum duration", 'non_pt_walk': "A journey without public transport, only walking", 'non_pt_bike': "A journey without public transport, only biking", 'non_pt_bss': "A journey without public transport, only bike sharing", } self.parsers = {} self.parsers["get"] = reqparse.RequestParser( argument_class=ArgumentDoc) parser_get = self.parsers["get"] parser_get.add_argument("from", type=str, dest="origin") parser_get.add_argument("to", type=str, dest="destination") parser_get.add_argument("datetime", type=date_time_format) parser_get.add_argument("datetime_represents", dest="clockwise", type=dt_represents, default=True) parser_get.add_argument("max_nb_transfers", type=int, dest="max_transfers") parser_get.add_argument("first_section_mode[]", type=option_value(modes), default=["walking"], dest="origin_mode", action="append") parser_get.add_argument("last_section_mode[]", type=option_value(modes), default=["walking"], dest="destination_mode", action="append") parser_get.add_argument("max_duration_to_pt", type=int, description="maximal duration of non public transport in second") parser_get.add_argument("max_walking_duration_to_pt", type=int, description="maximal duration of walking on public transport in second") parser_get.add_argument("max_bike_duration_to_pt", type=int, description="maximal duration of bike on public transport in second") parser_get.add_argument("max_bss_duration_to_pt", type=int, description="maximal duration of bss on public transport in second") parser_get.add_argument("max_car_duration_to_pt", type=int, description="maximal duration of car on public transport in second") parser_get.add_argument("walking_speed", type=float) parser_get.add_argument("bike_speed", type=float) parser_get.add_argument("bss_speed", type=float) parser_get.add_argument("car_speed", type=float) parser_get.add_argument("forbidden_uris[]", type=str, action="append") parser_get.add_argument("count", type=int) parser_get.add_argument("min_nb_journeys", type=int) parser_get.add_argument("max_nb_journeys", type=int) parser_get.add_argument("type", type=option_value(types), default="all") parser_get.add_argument("disruption_active", type=boolean, default=False) # a supprimer parser_get.add_argument("max_duration", type=int, default=3600*24) parser_get.add_argument("wheelchair", type=boolean, default=False) parser_get.add_argument("debug", type=boolean, default=False, hidden=True) # for retrocompatibility purpose, we duplicate (without []): parser_get.add_argument("first_section_mode", type=option_value(modes), action="append") parser_get.add_argument("last_section_mode", type=option_value(modes), action="append") parser_get.add_argument("show_codes", type=boolean, default=False, description="show more identification codes") parser_get.add_argument("traveler_type", type=option_value(travelers_profile.keys())) parser_get.add_argument("_override_scenario", type=str, description="debug param to specify a custom scenario") self.method_decorators.append(complete_links(self)) # manage post protocol (n-m calculation) self.parsers["post"] = deepcopy(parser_get) parser_post = self.parsers["post"] parser_post.add_argument("details", type=boolean, default=False, location="json") for index, elem in enumerate(parser_post.args): if elem.name in ["from", "to"]: parser_post.args[index].type = list parser_post.args[index].dest = elem.name parser_post.args[index].location = "json"