python-navitia-client 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- navitia_client/__init__.py +0 -0
- navitia_client/client/__init__.py +0 -0
- navitia_client/client/apis/__init__.py +0 -0
- navitia_client/client/apis/api_base_client.py +50 -0
- navitia_client/client/apis/arrival_apis.py +191 -0
- navitia_client/client/apis/contributors_apis.py +107 -0
- navitia_client/client/apis/coverage_apis.py +131 -0
- navitia_client/client/apis/datasets_apis.py +105 -0
- navitia_client/client/apis/departure_apis.py +211 -0
- navitia_client/client/apis/inverted_geocoding_apis.py +199 -0
- navitia_client/client/apis/isochrone_apis.py +196 -0
- navitia_client/client/apis/journeys_apis.py +629 -0
- navitia_client/client/apis/line_report_apis.py +106 -0
- navitia_client/client/apis/place_apis.py +74 -0
- navitia_client/client/apis/places_nearby_apis.py +354 -0
- navitia_client/client/apis/public_transport_objects_apis.py +88 -0
- navitia_client/client/apis/public_transportation_apis/__init__.py +10 -0
- navitia_client/client/apis/public_transportation_apis/commercial_mode_apis.py +251 -0
- navitia_client/client/apis/public_transportation_apis/company_apis.py +303 -0
- navitia_client/client/apis/public_transportation_apis/disruption_apis.py +305 -0
- navitia_client/client/apis/public_transportation_apis/entity_apis.py +330 -0
- navitia_client/client/apis/public_transportation_apis/line_apis.py +303 -0
- navitia_client/client/apis/public_transportation_apis/network_apis.py +303 -0
- navitia_client/client/apis/public_transportation_apis/physical_mode_apis.py +303 -0
- navitia_client/client/apis/public_transportation_apis/route_apis.py +303 -0
- navitia_client/client/apis/public_transportation_apis/stop_area_apis.py +303 -0
- navitia_client/client/apis/public_transportation_apis/stop_point_apis.py +303 -0
- navitia_client/client/apis/public_transportation_apis/vehicle_journey_apis.py +304 -0
- navitia_client/client/apis/route_schedules_apis.py +177 -0
- navitia_client/client/apis/stop_schedules_apis.py +181 -0
- navitia_client/client/apis/terminus_schedules_apis.py +186 -0
- navitia_client/client/apis/traffic_report_apis.py +106 -0
- navitia_client/client/exceptions.py +18 -0
- navitia_client/client/navitia_client.py +302 -0
- navitia_client/client/raw/__init__.py +0 -0
- navitia_client/client/raw/raw_client.py +58 -0
- navitia_client/entities/__init__.py +23 -0
- navitia_client/entities/access_point.py +10 -0
- navitia_client/entities/address.py +28 -0
- navitia_client/entities/administrative_region.py +59 -0
- navitia_client/entities/arrival.py +21 -0
- navitia_client/entities/base_entity.py +7 -0
- navitia_client/entities/company.py +16 -0
- navitia_client/entities/context.py +10 -0
- navitia_client/entities/contributor.py +19 -0
- navitia_client/entities/coord.py +15 -0
- navitia_client/entities/dataset.py +32 -0
- navitia_client/entities/departure.py +21 -0
- navitia_client/entities/direction.py +24 -0
- navitia_client/entities/display_information.py +43 -0
- navitia_client/entities/disruption.py +233 -0
- navitia_client/entities/equipment.py +42 -0
- navitia_client/entities/equipment_reports.py +10 -0
- navitia_client/entities/isochrones.py +30 -0
- navitia_client/entities/journey.py +133 -0
- navitia_client/entities/line_and_route.py +76 -0
- navitia_client/entities/line_report.py +18 -0
- navitia_client/entities/link.py +44 -0
- navitia_client/entities/network.py +16 -0
- navitia_client/entities/note.py +7 -0
- navitia_client/entities/pagination.py +19 -0
- navitia_client/entities/path.py +30 -0
- navitia_client/entities/pathway.py +11 -0
- navitia_client/entities/physical_mode.py +92 -0
- navitia_client/entities/place.py +40 -0
- navitia_client/entities/poi.py +16 -0
- navitia_client/entities/pt_datetime.py +31 -0
- navitia_client/entities/pt_object.py +57 -0
- navitia_client/entities/route_schedule.py +19 -0
- navitia_client/entities/schedule_table.py +59 -0
- navitia_client/entities/stand.py +16 -0
- navitia_client/entities/stop_area.py +82 -0
- navitia_client/entities/stop_datetime.py +39 -0
- navitia_client/entities/stop_schedule.py +59 -0
- navitia_client/entities/ticket.py +49 -0
- navitia_client/entities/traffic_report.py +21 -0
- navitia_client/entities/trip.py +13 -0
- navitia_client/entities/vehicle_journey.py +163 -0
- python_navitia_client-1.1.0.dist-info/LICENSE +21 -0
- python_navitia_client-1.1.0.dist-info/METADATA +114 -0
- python_navitia_client-1.1.0.dist-info/RECORD +83 -0
- python_navitia_client-1.1.0.dist-info/WHEEL +5 -0
- python_navitia_client-1.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
from typing import Any, Optional, Sequence, Tuple
|
|
2
|
+
from navitia_client.client.apis.api_base_client import ApiBaseClient
|
|
3
|
+
from navitia_client.client.apis.public_transportation_apis.entity_apis import EntityApi
|
|
4
|
+
from navitia_client.entities.pagination import Pagination
|
|
5
|
+
from navitia_client.entities.stop_area import StopArea
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class StopAreaApiClient(ApiBaseClient, EntityApi[StopArea]):
|
|
9
|
+
"""
|
|
10
|
+
API client for handling 'StopArea' entities in the Navitia API.
|
|
11
|
+
|
|
12
|
+
See https://doc.navitia.io/#pt-ref
|
|
13
|
+
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
entity_name : str
|
|
17
|
+
Name of the entity ('stop_areas').
|
|
18
|
+
get_navitia_api : method
|
|
19
|
+
Method to get the Navitia API.
|
|
20
|
+
|
|
21
|
+
Methods
|
|
22
|
+
-------
|
|
23
|
+
_get_entity_from_response(raw_entity_response: Any) -> Sequence[StopArea]:
|
|
24
|
+
Static method to extract StopArea instances from the raw API response.
|
|
25
|
+
|
|
26
|
+
list_entity_collection_from_region(
|
|
27
|
+
region_id: str,
|
|
28
|
+
start_page: int = 0,
|
|
29
|
+
count: int = 25,
|
|
30
|
+
depth: int = 1,
|
|
31
|
+
odt: str = "all",
|
|
32
|
+
distance: int = 200,
|
|
33
|
+
headsign: Optional[str] = None
|
|
34
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
35
|
+
List stop areas for a given region.
|
|
36
|
+
|
|
37
|
+
get_entity_by_id(
|
|
38
|
+
region_id: str,
|
|
39
|
+
object_id: str,
|
|
40
|
+
start_page: int = 0,
|
|
41
|
+
count: int = 25,
|
|
42
|
+
depth: int = 1,
|
|
43
|
+
odt: str = "all",
|
|
44
|
+
distance: int = 200,
|
|
45
|
+
headsign: Optional[str] = None
|
|
46
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
47
|
+
Get a stop area by its ID in a given region.
|
|
48
|
+
|
|
49
|
+
list_entity_collection_from_coordinates(
|
|
50
|
+
lon: float,
|
|
51
|
+
lat: float,
|
|
52
|
+
start_page: int = 0,
|
|
53
|
+
count: int = 25,
|
|
54
|
+
depth: int = 1,
|
|
55
|
+
odt: str = "all",
|
|
56
|
+
distance: int = 200,
|
|
57
|
+
headsign: Optional[str] = None
|
|
58
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
59
|
+
List stop areas for given geographic coordinates.
|
|
60
|
+
|
|
61
|
+
get_entity_by_id_and_coordinates(
|
|
62
|
+
lon: float,
|
|
63
|
+
lat: float,
|
|
64
|
+
object_id: str,
|
|
65
|
+
start_page: int = 0,
|
|
66
|
+
count: int = 25,
|
|
67
|
+
depth: int = 1,
|
|
68
|
+
odt: str = "all",
|
|
69
|
+
distance: int = 200,
|
|
70
|
+
headsign: Optional[str] = None
|
|
71
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
72
|
+
Get a stop area by its ID for given geographic coordinates.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
entity_name: str = "stop_areas"
|
|
76
|
+
get_navitia_api = ApiBaseClient.get_navitia_api
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def _get_entity_from_response(raw_entity_response: Any) -> Sequence[StopArea]:
|
|
80
|
+
"""
|
|
81
|
+
Static method to extract StopArea instances from the raw API response.
|
|
82
|
+
|
|
83
|
+
Parameters
|
|
84
|
+
----------
|
|
85
|
+
raw_entity_response : Any
|
|
86
|
+
Raw API response containing StopArea data.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
Sequence[StopArea]
|
|
91
|
+
List of StopArea instances.
|
|
92
|
+
"""
|
|
93
|
+
entities = []
|
|
94
|
+
for entity in raw_entity_response:
|
|
95
|
+
entities.append(StopArea.from_payload(entity))
|
|
96
|
+
return entities
|
|
97
|
+
|
|
98
|
+
def list_entity_collection_from_region(
|
|
99
|
+
self,
|
|
100
|
+
region_id: str,
|
|
101
|
+
start_page: int = 0,
|
|
102
|
+
count: int = 25,
|
|
103
|
+
depth: int = 1,
|
|
104
|
+
odt: str = "all",
|
|
105
|
+
distance: int = 200,
|
|
106
|
+
headsign: Optional[str] = None,
|
|
107
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
108
|
+
"""
|
|
109
|
+
List stop areas for a given region.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
region_id : str
|
|
114
|
+
ID of the region.
|
|
115
|
+
start_page : int, optional
|
|
116
|
+
Starting page number (default is 0).
|
|
117
|
+
count : int, optional
|
|
118
|
+
Number of items per page (default is 25).
|
|
119
|
+
depth : int, optional
|
|
120
|
+
Search depth (default is 1).
|
|
121
|
+
odt : str, optional
|
|
122
|
+
ODT type filter (default is "all").
|
|
123
|
+
distance : int, optional
|
|
124
|
+
Maximum search distance (default is 200).
|
|
125
|
+
headsign : Optional[str], optional
|
|
126
|
+
Stop area headsign.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
Tuple[Sequence[StopArea], Pagination]
|
|
131
|
+
List of StopArea instances and pagination information.
|
|
132
|
+
"""
|
|
133
|
+
filters = {
|
|
134
|
+
"start_page": start_page,
|
|
135
|
+
"count": count,
|
|
136
|
+
"depth": depth,
|
|
137
|
+
"odt": odt,
|
|
138
|
+
"distance": distance,
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if headsign is not None:
|
|
142
|
+
filters["headsign"] = headsign
|
|
143
|
+
url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}"
|
|
144
|
+
return self._get_entity_results(url, self.entity_name, filters)
|
|
145
|
+
|
|
146
|
+
def get_entity_by_id(
|
|
147
|
+
self,
|
|
148
|
+
region_id: str,
|
|
149
|
+
object_id: str,
|
|
150
|
+
start_page: int = 0,
|
|
151
|
+
count: int = 25,
|
|
152
|
+
depth: int = 1,
|
|
153
|
+
odt: str = "all",
|
|
154
|
+
distance: int = 200,
|
|
155
|
+
headsign: Optional[str] = None,
|
|
156
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
157
|
+
"""
|
|
158
|
+
Get a stop area by its ID in a given region.
|
|
159
|
+
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
region_id : str
|
|
163
|
+
ID of the region.
|
|
164
|
+
object_id : str
|
|
165
|
+
ID of the stop area.
|
|
166
|
+
start_page : int, optional
|
|
167
|
+
Starting page number (default is 0).
|
|
168
|
+
count : int, optional
|
|
169
|
+
Number of items per page (default is 25).
|
|
170
|
+
depth : int, optional
|
|
171
|
+
Search depth (default is 1).
|
|
172
|
+
odt : str, optional
|
|
173
|
+
ODT type filter (default is "all").
|
|
174
|
+
distance : int, optional
|
|
175
|
+
Maximum search distance (default is 200).
|
|
176
|
+
headsign : Optional[str], optional
|
|
177
|
+
Stop area headsign.
|
|
178
|
+
|
|
179
|
+
Returns
|
|
180
|
+
-------
|
|
181
|
+
Tuple[Sequence[StopArea], Pagination]
|
|
182
|
+
List of StopArea instances and pagination information.
|
|
183
|
+
"""
|
|
184
|
+
filters = {
|
|
185
|
+
"start_page": start_page,
|
|
186
|
+
"count": count,
|
|
187
|
+
"depth": depth,
|
|
188
|
+
"odt": odt,
|
|
189
|
+
"distance": distance,
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if headsign is not None:
|
|
193
|
+
filters["headsign"] = headsign
|
|
194
|
+
|
|
195
|
+
url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}"
|
|
196
|
+
return self._get_entity_results(url, self.entity_name, filters)
|
|
197
|
+
|
|
198
|
+
def list_entity_collection_from_coordinates(
|
|
199
|
+
self,
|
|
200
|
+
lon: float,
|
|
201
|
+
lat: float,
|
|
202
|
+
start_page: int = 0,
|
|
203
|
+
count: int = 25,
|
|
204
|
+
depth: int = 1,
|
|
205
|
+
odt: str = "all",
|
|
206
|
+
distance: int = 200,
|
|
207
|
+
headsign: Optional[str] = None,
|
|
208
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
209
|
+
"""
|
|
210
|
+
List stop areas for given geographic coordinates.
|
|
211
|
+
|
|
212
|
+
Parameters
|
|
213
|
+
----------
|
|
214
|
+
lon : float
|
|
215
|
+
Longitude.
|
|
216
|
+
lat : float
|
|
217
|
+
Latitude.
|
|
218
|
+
start_page : int, optional
|
|
219
|
+
Starting page number (default is 0).
|
|
220
|
+
count : int, optional
|
|
221
|
+
Number of items per page (default is 25).
|
|
222
|
+
depth : int, optional
|
|
223
|
+
Search depth (default is 1).
|
|
224
|
+
odt : str, optional
|
|
225
|
+
ODT type filter (default is "all").
|
|
226
|
+
distance : int, optional
|
|
227
|
+
Maximum search distance (default is 200).
|
|
228
|
+
headsign : Optional[str], optional
|
|
229
|
+
Stop area headsign.
|
|
230
|
+
|
|
231
|
+
Returns
|
|
232
|
+
-------
|
|
233
|
+
Tuple[Sequence[StopArea], Pagination]
|
|
234
|
+
List of StopArea instances and pagination information.
|
|
235
|
+
"""
|
|
236
|
+
filters = {
|
|
237
|
+
"start_page": start_page,
|
|
238
|
+
"count": count,
|
|
239
|
+
"depth": depth,
|
|
240
|
+
"odt": odt,
|
|
241
|
+
"distance": distance,
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if headsign is not None:
|
|
245
|
+
filters["headsign"] = headsign
|
|
246
|
+
|
|
247
|
+
url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}"
|
|
248
|
+
return self._get_entity_results(url, self.entity_name, filters)
|
|
249
|
+
|
|
250
|
+
def get_entity_by_id_and_coordinates(
|
|
251
|
+
self,
|
|
252
|
+
lon: float,
|
|
253
|
+
lat: float,
|
|
254
|
+
object_id: str,
|
|
255
|
+
start_page: int = 0,
|
|
256
|
+
count: int = 25,
|
|
257
|
+
depth: int = 1,
|
|
258
|
+
odt: str = "all",
|
|
259
|
+
distance: int = 200,
|
|
260
|
+
headsign: Optional[str] = None,
|
|
261
|
+
) -> Tuple[Sequence[StopArea], Pagination]:
|
|
262
|
+
"""
|
|
263
|
+
Get a stop area by its ID for given geographic coordinates.
|
|
264
|
+
|
|
265
|
+
Parameters
|
|
266
|
+
----------
|
|
267
|
+
lon : float
|
|
268
|
+
Longitude.
|
|
269
|
+
lat : float
|
|
270
|
+
Latitude.
|
|
271
|
+
object_id : str
|
|
272
|
+
ID of the stop area.
|
|
273
|
+
start_page : int, optional
|
|
274
|
+
Starting page number (default is 0).
|
|
275
|
+
count : int, optional
|
|
276
|
+
Number of items per page (default is 25).
|
|
277
|
+
depth : int, optional
|
|
278
|
+
Search depth (default is 1).
|
|
279
|
+
odt : str, optional
|
|
280
|
+
ODT type filter (default is "all").
|
|
281
|
+
distance : int, optional
|
|
282
|
+
Maximum search distance (default is 200).
|
|
283
|
+
headsign : Optional[str], optional
|
|
284
|
+
Stop area headsign.
|
|
285
|
+
|
|
286
|
+
Returns
|
|
287
|
+
-------
|
|
288
|
+
Tuple[Sequence[StopArea], Pagination]
|
|
289
|
+
List of StopArea instances and pagination information.
|
|
290
|
+
"""
|
|
291
|
+
filters = {
|
|
292
|
+
"start_page": start_page,
|
|
293
|
+
"count": count,
|
|
294
|
+
"depth": depth,
|
|
295
|
+
"odt": odt,
|
|
296
|
+
"distance": distance,
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if headsign is not None:
|
|
300
|
+
filters["headsign"] = headsign
|
|
301
|
+
|
|
302
|
+
url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}"
|
|
303
|
+
return self._get_entity_results(url, self.entity_name, filters)
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
from typing import Any, Optional, Sequence, Tuple
|
|
2
|
+
from navitia_client.client.apis.api_base_client import ApiBaseClient
|
|
3
|
+
from navitia_client.client.apis.public_transportation_apis.entity_apis import EntityApi
|
|
4
|
+
from navitia_client.entities.pagination import Pagination
|
|
5
|
+
from navitia_client.entities.stop_area import StopPoint
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class StopPointApiClient(ApiBaseClient, EntityApi[StopPoint]):
|
|
9
|
+
"""
|
|
10
|
+
API client for handling 'StopPoint' entities in the Navitia API.
|
|
11
|
+
|
|
12
|
+
See https://doc.navitia.io/#pt-ref
|
|
13
|
+
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
entity_name : str
|
|
17
|
+
Name of the entity ('stop_points').
|
|
18
|
+
get_navitia_api : method
|
|
19
|
+
Method to get the Navitia API.
|
|
20
|
+
|
|
21
|
+
Methods
|
|
22
|
+
-------
|
|
23
|
+
_get_entity_from_response(raw_entity_response: Any) -> Sequence[StopPoint]:
|
|
24
|
+
Static method to extract StopPoint instances from the raw API response.
|
|
25
|
+
|
|
26
|
+
list_entity_collection_from_region(
|
|
27
|
+
region_id: str,
|
|
28
|
+
start_page: int = 0,
|
|
29
|
+
count: int = 25,
|
|
30
|
+
depth: int = 1,
|
|
31
|
+
odt: str = "all",
|
|
32
|
+
distance: int = 200,
|
|
33
|
+
headsign: Optional[str] = None
|
|
34
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
35
|
+
List stop points for a given region.
|
|
36
|
+
|
|
37
|
+
get_entity_by_id(
|
|
38
|
+
region_id: str,
|
|
39
|
+
object_id: str,
|
|
40
|
+
start_page: int = 0,
|
|
41
|
+
count: int = 25,
|
|
42
|
+
depth: int = 1,
|
|
43
|
+
odt: str = "all",
|
|
44
|
+
distance: int = 200,
|
|
45
|
+
headsign: Optional[str] = None
|
|
46
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
47
|
+
Get a stop point by its ID in a given region.
|
|
48
|
+
|
|
49
|
+
list_entity_collection_from_coordinates(
|
|
50
|
+
lon: float,
|
|
51
|
+
lat: float,
|
|
52
|
+
start_page: int = 0,
|
|
53
|
+
count: int = 25,
|
|
54
|
+
depth: int = 1,
|
|
55
|
+
odt: str = "all",
|
|
56
|
+
distance: int = 200,
|
|
57
|
+
headsign: Optional[str] = None
|
|
58
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
59
|
+
List stop points for given geographic coordinates.
|
|
60
|
+
|
|
61
|
+
get_entity_by_id_and_coordinates(
|
|
62
|
+
lon: float,
|
|
63
|
+
lat: float,
|
|
64
|
+
object_id: str,
|
|
65
|
+
start_page: int = 0,
|
|
66
|
+
count: int = 25,
|
|
67
|
+
depth: int = 1,
|
|
68
|
+
odt: str = "all",
|
|
69
|
+
distance: int = 200,
|
|
70
|
+
headsign: Optional[str] = None
|
|
71
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
72
|
+
Get a stop point by its ID for given geographic coordinates.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
entity_name: str = "stop_points"
|
|
76
|
+
get_navitia_api = ApiBaseClient.get_navitia_api
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def _get_entity_from_response(raw_entity_response: Any) -> Sequence[StopPoint]:
|
|
80
|
+
"""
|
|
81
|
+
Static method to extract StopPoint instances from the raw API response.
|
|
82
|
+
|
|
83
|
+
Parameters
|
|
84
|
+
----------
|
|
85
|
+
raw_entity_response : Any
|
|
86
|
+
Raw API response containing StopPoint data.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
Sequence[StopPoint]
|
|
91
|
+
List of StopPoint instances.
|
|
92
|
+
"""
|
|
93
|
+
entities = []
|
|
94
|
+
for entity in raw_entity_response:
|
|
95
|
+
entities.append(StopPoint.from_payload(entity))
|
|
96
|
+
return entities
|
|
97
|
+
|
|
98
|
+
def list_entity_collection_from_region(
|
|
99
|
+
self,
|
|
100
|
+
region_id: str,
|
|
101
|
+
start_page: int = 0,
|
|
102
|
+
count: int = 25,
|
|
103
|
+
depth: int = 1,
|
|
104
|
+
odt: str = "all",
|
|
105
|
+
distance: int = 200,
|
|
106
|
+
headsign: Optional[str] = None,
|
|
107
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
108
|
+
"""
|
|
109
|
+
List stop points for a given region.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
region_id : str
|
|
114
|
+
ID of the region.
|
|
115
|
+
start_page : int, optional
|
|
116
|
+
Starting page number (default is 0).
|
|
117
|
+
count : int, optional
|
|
118
|
+
Number of items per page (default is 25).
|
|
119
|
+
depth : int, optional
|
|
120
|
+
Search depth (default is 1).
|
|
121
|
+
odt : str, optional
|
|
122
|
+
ODT type filter (default is "all").
|
|
123
|
+
distance : int, optional
|
|
124
|
+
Maximum search distance (default is 200).
|
|
125
|
+
headsign : Optional[str], optional
|
|
126
|
+
Stop point headsign.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
Tuple[Sequence[StopPoint], Pagination]
|
|
131
|
+
List of StopPoint instances and pagination information.
|
|
132
|
+
"""
|
|
133
|
+
filters = {
|
|
134
|
+
"start_page": start_page,
|
|
135
|
+
"count": count,
|
|
136
|
+
"depth": depth,
|
|
137
|
+
"odt": odt,
|
|
138
|
+
"distance": distance,
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if headsign is not None:
|
|
142
|
+
filters["headsign"] = headsign
|
|
143
|
+
url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}"
|
|
144
|
+
return self._get_entity_results(url, self.entity_name, filters)
|
|
145
|
+
|
|
146
|
+
def get_entity_by_id(
|
|
147
|
+
self,
|
|
148
|
+
region_id: str,
|
|
149
|
+
object_id: str,
|
|
150
|
+
start_page: int = 0,
|
|
151
|
+
count: int = 25,
|
|
152
|
+
depth: int = 1,
|
|
153
|
+
odt: str = "all",
|
|
154
|
+
distance: int = 200,
|
|
155
|
+
headsign: Optional[str] = None,
|
|
156
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
157
|
+
"""
|
|
158
|
+
Get a stop point by its ID in a given region.
|
|
159
|
+
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
region_id : str
|
|
163
|
+
ID of the region.
|
|
164
|
+
object_id : str
|
|
165
|
+
ID of the stop point.
|
|
166
|
+
start_page : int, optional
|
|
167
|
+
Starting page number (default is 0).
|
|
168
|
+
count : int, optional
|
|
169
|
+
Number of items per page (default is 25).
|
|
170
|
+
depth : int, optional
|
|
171
|
+
Search depth (default is 1).
|
|
172
|
+
odt : str, optional
|
|
173
|
+
ODT type filter (default is "all").
|
|
174
|
+
distance : int, optional
|
|
175
|
+
Maximum search distance (default is 200).
|
|
176
|
+
headsign : Optional[str], optional
|
|
177
|
+
Stop point headsign.
|
|
178
|
+
|
|
179
|
+
Returns
|
|
180
|
+
-------
|
|
181
|
+
Tuple[Sequence[StopPoint], Pagination]
|
|
182
|
+
List of StopPoint instances and pagination information.
|
|
183
|
+
"""
|
|
184
|
+
filters = {
|
|
185
|
+
"start_page": start_page,
|
|
186
|
+
"count": count,
|
|
187
|
+
"depth": depth,
|
|
188
|
+
"odt": odt,
|
|
189
|
+
"distance": distance,
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if headsign is not None:
|
|
193
|
+
filters["headsign"] = headsign
|
|
194
|
+
|
|
195
|
+
url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}"
|
|
196
|
+
return self._get_entity_results(url, self.entity_name, filters)
|
|
197
|
+
|
|
198
|
+
def list_entity_collection_from_coordinates(
|
|
199
|
+
self,
|
|
200
|
+
lon: float,
|
|
201
|
+
lat: float,
|
|
202
|
+
start_page: int = 0,
|
|
203
|
+
count: int = 25,
|
|
204
|
+
depth: int = 1,
|
|
205
|
+
odt: str = "all",
|
|
206
|
+
distance: int = 200,
|
|
207
|
+
headsign: Optional[str] = None,
|
|
208
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
209
|
+
"""
|
|
210
|
+
List stop points for given geographic coordinates.
|
|
211
|
+
|
|
212
|
+
Parameters
|
|
213
|
+
----------
|
|
214
|
+
lon : float
|
|
215
|
+
Longitude.
|
|
216
|
+
lat : float
|
|
217
|
+
Latitude.
|
|
218
|
+
start_page : int, optional
|
|
219
|
+
Starting page number (default is 0).
|
|
220
|
+
count : int, optional
|
|
221
|
+
Number of items per page (default is 25).
|
|
222
|
+
depth : int, optional
|
|
223
|
+
Search depth (default is 1).
|
|
224
|
+
odt : str, optional
|
|
225
|
+
ODT type filter (default is "all").
|
|
226
|
+
distance : int, optional
|
|
227
|
+
Maximum search distance (default is 200).
|
|
228
|
+
headsign : Optional[str], optional
|
|
229
|
+
Stop point headsign.
|
|
230
|
+
|
|
231
|
+
Returns
|
|
232
|
+
-------
|
|
233
|
+
Tuple[Sequence[StopPoint], Pagination]
|
|
234
|
+
List of StopPoint instances and pagination information.
|
|
235
|
+
"""
|
|
236
|
+
filters = {
|
|
237
|
+
"start_page": start_page,
|
|
238
|
+
"count": count,
|
|
239
|
+
"depth": depth,
|
|
240
|
+
"odt": odt,
|
|
241
|
+
"distance": distance,
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if headsign is not None:
|
|
245
|
+
filters["headsign"] = headsign
|
|
246
|
+
|
|
247
|
+
url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}"
|
|
248
|
+
return self._get_entity_results(url, self.entity_name, filters)
|
|
249
|
+
|
|
250
|
+
def get_entity_by_id_and_coordinates(
|
|
251
|
+
self,
|
|
252
|
+
lon: float,
|
|
253
|
+
lat: float,
|
|
254
|
+
object_id: str,
|
|
255
|
+
start_page: int = 0,
|
|
256
|
+
count: int = 25,
|
|
257
|
+
depth: int = 1,
|
|
258
|
+
odt: str = "all",
|
|
259
|
+
distance: int = 200,
|
|
260
|
+
headsign: Optional[str] = None,
|
|
261
|
+
) -> Tuple[Sequence[StopPoint], Pagination]:
|
|
262
|
+
"""
|
|
263
|
+
Get a stop point by its ID for given geographic coordinates.
|
|
264
|
+
|
|
265
|
+
Parameters
|
|
266
|
+
----------
|
|
267
|
+
lon : float
|
|
268
|
+
Longitude.
|
|
269
|
+
lat : float
|
|
270
|
+
Latitude.
|
|
271
|
+
object_id : str
|
|
272
|
+
ID of the stop point.
|
|
273
|
+
start_page : int, optional
|
|
274
|
+
Starting page number (default is 0).
|
|
275
|
+
count : int, optional
|
|
276
|
+
Number of items per page (default is 25).
|
|
277
|
+
depth : int, optional
|
|
278
|
+
Search depth (default is 1).
|
|
279
|
+
odt : str, optional
|
|
280
|
+
ODT type filter (default is "all").
|
|
281
|
+
distance : int, optional
|
|
282
|
+
Maximum search distance (default is 200).
|
|
283
|
+
headsign : Optional[str], optional
|
|
284
|
+
Stop point headsign.
|
|
285
|
+
|
|
286
|
+
Returns
|
|
287
|
+
-------
|
|
288
|
+
Tuple[Sequence[StopPoint], Pagination]
|
|
289
|
+
List of StopPoint instances and pagination information.
|
|
290
|
+
"""
|
|
291
|
+
filters = {
|
|
292
|
+
"start_page": start_page,
|
|
293
|
+
"count": count,
|
|
294
|
+
"depth": depth,
|
|
295
|
+
"odt": odt,
|
|
296
|
+
"distance": distance,
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if headsign is not None:
|
|
300
|
+
filters["headsign"] = headsign
|
|
301
|
+
|
|
302
|
+
url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}"
|
|
303
|
+
return self._get_entity_results(url, self.entity_name, filters)
|