koleo-cli 0.2.137.16__py3-none-any.whl → 0.2.137.18__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.
Potentially problematic release.
This version of koleo-cli might be problematic. Click here for more details.
- koleo/__init__.py +1 -1
- koleo/api/__init__.py +2 -0
- koleo/api/base.py +70 -0
- koleo/api/client.py +221 -0
- koleo/api/errors.py +46 -0
- koleo/api/logging.py +56 -0
- koleo/api/types.py +488 -0
- koleo/args.py +279 -0
- koleo/cli/__init__.py +9 -0
- koleo/cli/aliases.py +15 -0
- koleo/cli/base.py +103 -0
- koleo/cli/connections.py +142 -0
- koleo/cli/seats.py +103 -0
- koleo/cli/station_board.py +72 -0
- koleo/cli/stations.py +37 -0
- koleo/cli/train_info.py +142 -0
- koleo/cli/utils.py +27 -0
- koleo/storage.py +76 -19
- koleo/utils.py +95 -8
- koleo_cli-0.2.137.18.dist-info/METADATA +103 -0
- koleo_cli-0.2.137.18.dist-info/RECORD +26 -0
- {koleo_cli-0.2.137.16.dist-info → koleo_cli-0.2.137.18.dist-info}/WHEEL +1 -1
- koleo_cli-0.2.137.18.dist-info/entry_points.txt +2 -0
- koleo/api.py +0 -161
- koleo/cli.py +0 -550
- koleo/types.py +0 -237
- koleo_cli-0.2.137.16.dist-info/METADATA +0 -71
- koleo_cli-0.2.137.16.dist-info/RECORD +0 -13
- koleo_cli-0.2.137.16.dist-info/entry_points.txt +0 -2
- {koleo_cli-0.2.137.16.dist-info → koleo_cli-0.2.137.18.dist-info/licenses}/LICENSE +0 -0
- {koleo_cli-0.2.137.16.dist-info → koleo_cli-0.2.137.18.dist-info}/top_level.txt +0 -0
koleo/api/types.py
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class BaseStationInfo(t.TypedDict):
|
|
5
|
+
id: int
|
|
6
|
+
name: str
|
|
7
|
+
name_slug: str
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
StationType = t.Literal["TopographicalPlace", "Quay", "StopPlace"]
|
|
11
|
+
TransportMode = t.Literal[
|
|
12
|
+
"bus",
|
|
13
|
+
"rail",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# i want to kms
|
|
18
|
+
class ExtendedStationInfo(BaseStationInfo):
|
|
19
|
+
latitude: float
|
|
20
|
+
longitude: float
|
|
21
|
+
hits: int
|
|
22
|
+
ibnr: int
|
|
23
|
+
city: str | None
|
|
24
|
+
region: str
|
|
25
|
+
country: str
|
|
26
|
+
localised_name: str
|
|
27
|
+
is_group: bool
|
|
28
|
+
has_announcements: bool
|
|
29
|
+
is_nearby_station_enabled: bool
|
|
30
|
+
is_livesearch_displayable: bool
|
|
31
|
+
type: StationType
|
|
32
|
+
transport_mode: TransportMode | None
|
|
33
|
+
time_zone: str # Europe/Warsaw
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class SearchStationInfo(BaseStationInfo):
|
|
37
|
+
ibnr: int
|
|
38
|
+
localised_name: str
|
|
39
|
+
on_demand: bool
|
|
40
|
+
type: StationType
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class StationBannerClockHandsPositon(t.TypedDict):
|
|
44
|
+
x: float
|
|
45
|
+
y: float
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class StationBannerClockHands(t.TypedDict):
|
|
49
|
+
url: str | None
|
|
50
|
+
position: StationBannerClockHandsPositon
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class StationBannerClock(t.TypedDict):
|
|
54
|
+
visible: bool | None
|
|
55
|
+
hands: StationBannerClockHands
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class StationBanner(t.TypedDict):
|
|
59
|
+
url: str
|
|
60
|
+
clock: StationBannerClock
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class Address(t.TypedDict):
|
|
64
|
+
full: str
|
|
65
|
+
zip: str
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class Feature(t.TypedDict):
|
|
69
|
+
id: str
|
|
70
|
+
name: str
|
|
71
|
+
available: bool
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class StationOpeningHours(t.TypedDict):
|
|
75
|
+
day: int # 0-6
|
|
76
|
+
open: str # 00:00
|
|
77
|
+
close: str # 24:00
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class StationDetails(t.TypedDict):
|
|
81
|
+
banner: StationBanner
|
|
82
|
+
address: Address
|
|
83
|
+
lat: float
|
|
84
|
+
lon: float
|
|
85
|
+
opening_hours: list[StationOpeningHours]
|
|
86
|
+
features: list[Feature]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class StationLocalizedToTrain(BaseStationInfo):
|
|
90
|
+
train_id: int
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ApiBrand(t.TypedDict):
|
|
94
|
+
id: int
|
|
95
|
+
name: str # EIC, IC, IR, REG, ...
|
|
96
|
+
display_name: str
|
|
97
|
+
logo_text: str
|
|
98
|
+
color: str # hex
|
|
99
|
+
carrier_id: int
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class Carrier(t.TypedDict):
|
|
103
|
+
id: int
|
|
104
|
+
name: str # Koleje Dolnośląskie, POLREGIO
|
|
105
|
+
short_name: str # KD, PR
|
|
106
|
+
slug: str
|
|
107
|
+
legal_name: str # PKP Szybka Kolej Miejska w Trójmieście Sp.z o.o.
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class DiscountInfo(t.TypedDict):
|
|
111
|
+
id: int
|
|
112
|
+
passenger_percentage: int
|
|
113
|
+
display_passenger_percentage: float
|
|
114
|
+
flyer_second_class_percentage: int
|
|
115
|
+
flyer_first_class_percentage: int
|
|
116
|
+
express_second_class_percentage: int
|
|
117
|
+
express_first_class_percentage: int
|
|
118
|
+
dependent_on_ids: list[int]
|
|
119
|
+
name: str
|
|
120
|
+
rank: int
|
|
121
|
+
season_passenger_percentage: int
|
|
122
|
+
displayable: bool
|
|
123
|
+
is_company: bool
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class TrainOnStationInfo(t.TypedDict):
|
|
127
|
+
arrival: str | None # first station
|
|
128
|
+
departure: str | None # last station
|
|
129
|
+
stations: list[StationLocalizedToTrain]
|
|
130
|
+
train_full_name: str
|
|
131
|
+
brand_id: int
|
|
132
|
+
platform: str # could be empty; some countries dont use arabic numerals or even tracks
|
|
133
|
+
track: str # could be empty; some countries dont use arabic numerals or even tracks
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class TrainCalendar(t.TypedDict):
|
|
137
|
+
id: int
|
|
138
|
+
train_nr: int
|
|
139
|
+
train_name: str
|
|
140
|
+
trainBrand: int
|
|
141
|
+
dates: list[str] # Y-M-D
|
|
142
|
+
train_ids: list[int]
|
|
143
|
+
date_train_map: dict[str, int]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class TrainCalendarResponse(t.TypedDict):
|
|
147
|
+
train_calendars: list[TrainCalendar]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class TimeDict(t.TypedDict):
|
|
151
|
+
hour: int
|
|
152
|
+
minute: int
|
|
153
|
+
second: int
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
TrainAttributeTuple = t.Tuple[int, str, str, str, bool, str]
|
|
157
|
+
# id, name, start_station, end_station, no idea, style?( <- "icon-warning"?)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class TrainDetail(t.TypedDict):
|
|
161
|
+
id: int
|
|
162
|
+
train_nr: int
|
|
163
|
+
name: str | None
|
|
164
|
+
train_full_name: str
|
|
165
|
+
run_desc: str # "09.09-15.09 - w pt - nd; 16.09-29.09, 14.10-03.11 - codziennie;"
|
|
166
|
+
carrier_id: int
|
|
167
|
+
brand_id: int
|
|
168
|
+
train_name: int # wtf
|
|
169
|
+
duration_offset: int # wtf?
|
|
170
|
+
db_train_nr: int # lol
|
|
171
|
+
train_attributes: list[TrainAttributeTuple]
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class TrainStop(t.TypedDict):
|
|
175
|
+
id: int
|
|
176
|
+
station_id: int
|
|
177
|
+
station_name: str
|
|
178
|
+
station_slug: str
|
|
179
|
+
train_id: int
|
|
180
|
+
arrival: TimeDict
|
|
181
|
+
departure: TimeDict
|
|
182
|
+
position: int # the stop nr
|
|
183
|
+
train_nr: int | None
|
|
184
|
+
brand_id: int
|
|
185
|
+
distance: int # meters
|
|
186
|
+
entry_only: bool
|
|
187
|
+
exit_only: bool
|
|
188
|
+
station_display_name: str
|
|
189
|
+
platform: str
|
|
190
|
+
vehicle_type: str | None # ED161
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class TrainDetailResponse(t.TypedDict):
|
|
194
|
+
train: TrainDetail
|
|
195
|
+
stops: list[TrainStop]
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class ConnectionTrainStop(t.TypedDict):
|
|
199
|
+
arrival: TimeDict | str # WTF KOLEO!!!!
|
|
200
|
+
departure: TimeDict | str # WTF KOLEO!!!!
|
|
201
|
+
distance: int
|
|
202
|
+
in_path: bool
|
|
203
|
+
station_id: int
|
|
204
|
+
next_day: bool
|
|
205
|
+
position: int
|
|
206
|
+
train_nr: int
|
|
207
|
+
brand_id: int
|
|
208
|
+
entry_only: bool
|
|
209
|
+
exit_only: bool
|
|
210
|
+
platform: str
|
|
211
|
+
track: str
|
|
212
|
+
on_demand: bool
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class ConnectionTrainDetail(TrainDetail):
|
|
216
|
+
arrival: TimeDict | str # WTF KOLEO!!!!
|
|
217
|
+
departure: TimeDict | str # WTF KOLEO!!!!
|
|
218
|
+
stops: list[ConnectionTrainStop]
|
|
219
|
+
bookable: bool
|
|
220
|
+
train_attribute_ids: list[int]
|
|
221
|
+
travel_time: int
|
|
222
|
+
direction: str
|
|
223
|
+
start_station_id: int
|
|
224
|
+
end_station_id: int
|
|
225
|
+
fixed_carriage_composition: bool
|
|
226
|
+
is_option_groups_available: bool
|
|
227
|
+
train_id: int # wtf!!!!!!!!!!!
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class ErrorDict(t.TypedDict):
|
|
231
|
+
type: str
|
|
232
|
+
value: str
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class ConnectionDetail(t.TypedDict):
|
|
236
|
+
id: int
|
|
237
|
+
distance: int
|
|
238
|
+
purchasable: bool
|
|
239
|
+
purchasable_errors: list[ErrorDict]
|
|
240
|
+
travel_time: int
|
|
241
|
+
changes: int
|
|
242
|
+
needs_document: bool
|
|
243
|
+
brand_ids: list[int]
|
|
244
|
+
start_station_id: int
|
|
245
|
+
end_station_id: int
|
|
246
|
+
arrival: TimeDict | str # WTF KOLEO!!!!
|
|
247
|
+
departure: TimeDict | str # WTF KOLEO!!!!
|
|
248
|
+
bookable: bool
|
|
249
|
+
special_event_slug: str | None
|
|
250
|
+
is_advanced_travel_options: bool
|
|
251
|
+
is_child_birthday_required: bool
|
|
252
|
+
max_passengers_count: bool
|
|
253
|
+
constriction_info: list[str]
|
|
254
|
+
is_estimated_timetable_available: bool
|
|
255
|
+
trains: list[ConnectionTrainDetail]
|
|
256
|
+
eol_connection_uuid: str | None
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
class SpecialCompartmentType(t.TypedDict):
|
|
260
|
+
id: int
|
|
261
|
+
icon: str
|
|
262
|
+
name: str
|
|
263
|
+
information: str
|
|
264
|
+
terms: str
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
SeatState = t.Literal["FREE", "RESERVED", "BLOCKED"]
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class Seat(t.TypedDict):
|
|
271
|
+
carriage_nr: str # number
|
|
272
|
+
seat_nr: str # number
|
|
273
|
+
special_compartment_id: int
|
|
274
|
+
state: SeatState
|
|
275
|
+
placement_id: int # 1 -> okno, 2 -> korytarz, 7 -> środek
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class SeatsAvailabilityResponse(t.TypedDict):
|
|
279
|
+
special_compartment_types: list[SpecialCompartmentType]
|
|
280
|
+
seats: list[Seat]
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class Price(t.TypedDict):
|
|
284
|
+
id: int
|
|
285
|
+
connection_id: int
|
|
286
|
+
value: str
|
|
287
|
+
tariff_ids: list[int]
|
|
288
|
+
tariff_names: list[str]
|
|
289
|
+
validity: str
|
|
290
|
+
area_extract: ...
|
|
291
|
+
document_required: bool
|
|
292
|
+
valid_hours: float
|
|
293
|
+
changes_allowed: bool
|
|
294
|
+
bike_price: str | None
|
|
295
|
+
luggage_price: str | None
|
|
296
|
+
dog_price: str | None
|
|
297
|
+
bike_available: bool
|
|
298
|
+
dog_available: bool
|
|
299
|
+
luggage_available: bool
|
|
300
|
+
two_way: bool
|
|
301
|
+
warning: str | None
|
|
302
|
+
is_bike: bool
|
|
303
|
+
main_ticket_nr_required: bool
|
|
304
|
+
allows_zero_price: bool
|
|
305
|
+
is_seat_booking: bool
|
|
306
|
+
is_booking_after_purchase_available: bool
|
|
307
|
+
is_two_way: bool
|
|
308
|
+
has_pr_tariff: bool
|
|
309
|
+
tariff_descriptions: list[str]
|
|
310
|
+
discount_percentage: int
|
|
311
|
+
uncertain_to: bool
|
|
312
|
+
dividable: bool
|
|
313
|
+
limited_bike_price: str | None
|
|
314
|
+
has_ic_tariff: bool
|
|
315
|
+
has_valid_anticommunist_passengers: bool
|
|
316
|
+
has_valid_baby_passengers: bool
|
|
317
|
+
is_luggage_plus_available: bool
|
|
318
|
+
kdr_bike_price_available: bool
|
|
319
|
+
available_return_days: list[str]
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class Placement(t.TypedDict):
|
|
323
|
+
id: int
|
|
324
|
+
name: str
|
|
325
|
+
key: str
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
class CompartmentType(t.TypedDict):
|
|
329
|
+
id: int
|
|
330
|
+
rank: int | None
|
|
331
|
+
name: str
|
|
332
|
+
selected: bool
|
|
333
|
+
terms: str
|
|
334
|
+
information: str
|
|
335
|
+
placement_selection_for_each_passenger_possible: bool
|
|
336
|
+
placements: list[Placement]
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
class ReservatioModePreference(t.TypedDict):
|
|
340
|
+
available: bool
|
|
341
|
+
compartment_types: list[CompartmentType]
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
class ResevervationMode(t.TypedDict):
|
|
345
|
+
seat_map: bool
|
|
346
|
+
place_indication: bool
|
|
347
|
+
adjacent_place_indication: bool
|
|
348
|
+
preferences: ReservatioModePreference
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class PlaceType(t.TypedDict):
|
|
352
|
+
id: int | None
|
|
353
|
+
icon: str
|
|
354
|
+
place_types_label: str
|
|
355
|
+
name: str
|
|
356
|
+
price: float
|
|
357
|
+
base_price: float
|
|
358
|
+
unavailable_help_text: str
|
|
359
|
+
available: bool
|
|
360
|
+
selected: bool
|
|
361
|
+
uncertain: bool
|
|
362
|
+
capacity: int
|
|
363
|
+
place_types: "list[PlaceType]"
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
class TrainPlaceType(t.TypedDict):
|
|
367
|
+
id: int
|
|
368
|
+
train_nr: int
|
|
369
|
+
place_type: PlaceType
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
class NestedTrainPlaceTypesResponse(t.TypedDict):
|
|
373
|
+
train_place_types: list[TrainPlaceType]
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class CurrentSession(t.TypedDict):
|
|
377
|
+
id: t.Literal["current"]
|
|
378
|
+
email: str
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
class TrainCompositonCarriage(t.TypedDict):
|
|
382
|
+
positon: int
|
|
383
|
+
number: str # lol
|
|
384
|
+
carriage_type_id: int
|
|
385
|
+
bookable: bool
|
|
386
|
+
is_default: bool
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
Direction = t.Literal["right", "left"]
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
class SimpleTrainDirection(t.TypedDict):
|
|
393
|
+
type: t.Literal["simple"]
|
|
394
|
+
direction: Direction
|
|
395
|
+
reversingOnRoute: bool
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
class TrainComposition(t.TypedDict):
|
|
399
|
+
direction: SimpleTrainDirection
|
|
400
|
+
carriages: list[TrainCompositonCarriage]
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class CarriageSeat(t.TypedDict):
|
|
404
|
+
nr: int
|
|
405
|
+
seat_type_id: int
|
|
406
|
+
x: int
|
|
407
|
+
y: int
|
|
408
|
+
color: str | None
|
|
409
|
+
compartment_type_id: (
|
|
410
|
+
int | None
|
|
411
|
+
) # not implemented by koleo, returns 1: "wagon bezprzedziałowy" for "wagon przedziałowy"
|
|
412
|
+
placement_id: int | None
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
class CarriageSeatType(t.TypedDict):
|
|
416
|
+
id: int
|
|
417
|
+
key: str
|
|
418
|
+
width: int
|
|
419
|
+
height: int
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
class CarriageType(t.TypedDict):
|
|
423
|
+
id: int
|
|
424
|
+
key: str
|
|
425
|
+
image_key: str
|
|
426
|
+
seats: list[CarriageSeat]
|
|
427
|
+
seat_types: list[CarriageSeatType]
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class Passenger(t.TypedDict):
|
|
431
|
+
id: int
|
|
432
|
+
first_name: str
|
|
433
|
+
last_name: str
|
|
434
|
+
discount_id: int
|
|
435
|
+
discount_card_ids: list[int]
|
|
436
|
+
birthday: str
|
|
437
|
+
fellow: bool
|
|
438
|
+
is_selected: bool
|
|
439
|
+
avatar_url: str | None
|
|
440
|
+
active: bool
|
|
441
|
+
identity_document_type_id: int | None
|
|
442
|
+
identity_document_number: str | None
|
|
443
|
+
company_code: str | None
|
|
444
|
+
has_big_discount: bool
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
class User(CurrentSession):
|
|
448
|
+
locale: Placement
|
|
449
|
+
passenger_id: int
|
|
450
|
+
consent_to_terms: bool
|
|
451
|
+
consent_to_privacy: bool
|
|
452
|
+
consent_to_trade_info: bool | None
|
|
453
|
+
constriction_notifications: bool
|
|
454
|
+
wallet_id: int
|
|
455
|
+
lka_wallet_id: int
|
|
456
|
+
money_back: bool
|
|
457
|
+
masscollect_account_number: str | None
|
|
458
|
+
affiliate_code: str | None
|
|
459
|
+
application_installed: bool
|
|
460
|
+
has_exchange_order: bool | None
|
|
461
|
+
should_use_new_travel_options: bool
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
class Wallet(t.TypedDict):
|
|
465
|
+
id: int
|
|
466
|
+
balance: int # 8.75 -> 875
|
|
467
|
+
last_transaction: str | None
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
class CurrentUser(t.TypedDict):
|
|
471
|
+
passengers: list[Passenger]
|
|
472
|
+
users: list[User]
|
|
473
|
+
wallets: list[Wallet]
|
|
474
|
+
lka_wallets: list[Wallet]
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
class StationKeyword(t.TypedDict):
|
|
478
|
+
id: int
|
|
479
|
+
keyword: str
|
|
480
|
+
station_id: int
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class TrainAttribute(t.TypedDict):
|
|
484
|
+
id: int
|
|
485
|
+
name: str
|
|
486
|
+
short_name: str
|
|
487
|
+
rank: int
|
|
488
|
+
warning: bool
|