MouseTools 4.3.1__tar.gz → 4.4.1__tar.gz
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.
- {mousetools-4.3.1 → mousetools-4.4.1}/PKG-INFO +2 -2
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/api/menu.py +71 -71
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/api/search.py +2 -2
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/auth.py +8 -8
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/__init__.py +21 -10
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/calendar/__init__.py +33 -21
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/characters/__init__.py +3 -3
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/enums.py +11 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/facilities/__init__.py +81 -74
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/facilitystatus/__init__.py +32 -19
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/forecastedwaittimes/__init__.py +3 -3
- mousetools-4.4.1/mousetools/channels/today/__init__.py +121 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/decorators.py +21 -2
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/mixins/couchbase.py +19 -12
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/mixins/disney.py +6 -9
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools.egg-info/PKG-INFO +2 -2
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools.egg-info/SOURCES.txt +1 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools.egg-info/requires.txt +1 -1
- {mousetools-4.3.1 → mousetools-4.4.1}/pyproject.toml +36 -7
- {mousetools-4.3.1 → mousetools-4.4.1}/LICENSE +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/README.md +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/__init__.py +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/api/__init__.py +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/channels/facilities/enums.py +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/enums.py +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/mixins/__init__.py +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools/resources/environments.bin +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools.egg-info/dependency_links.txt +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/mousetools.egg-info/top_level.txt +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/setup.cfg +0 -0
- {mousetools-4.3.1 → mousetools-4.4.1}/tests/test_mixins.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mousetools
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4.1
|
|
4
4
|
Summary: An unofficial Python wrapper for Disney's API
|
|
5
5
|
Author: Scott Caratozzolo
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,9 +17,9 @@ Classifier: Operating System :: OS Independent
|
|
|
17
17
|
Requires-Python: <4.0,>=3.9
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: httpx>=0.27.2
|
|
21
20
|
Requires-Dist: pycryptodome>=3.22.0
|
|
22
21
|
Requires-Dist: python-dateutil>=2.9.0.post0
|
|
22
|
+
Requires-Dist: requests>=2.32.3
|
|
23
23
|
Requires-Dist: tzdata>=2025.2
|
|
24
24
|
Dynamic: license-file
|
|
25
25
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
import typing
|
|
3
2
|
from datetime import datetime, timedelta
|
|
3
|
+
from typing import Optional
|
|
4
4
|
from zoneinfo import ZoneInfo
|
|
5
5
|
|
|
6
6
|
from dateutil.parser import isoparse
|
|
@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class MenuItem:
|
|
16
|
-
def __init__(self, raw_item_data: dict, parent_resturant_id:
|
|
16
|
+
def __init__(self, raw_item_data: dict, parent_resturant_id: Optional[str] = None) -> None:
|
|
17
17
|
self._raw_item_data = raw_item_data
|
|
18
18
|
self._parent_restaurant_id = parent_resturant_id
|
|
19
19
|
|
|
@@ -21,118 +21,118 @@ class MenuItem:
|
|
|
21
21
|
return f"MenuItem(entity_id={self.entity_id}, parent_resturant_id={self._parent_restaurant_id})"
|
|
22
22
|
|
|
23
23
|
@json_property
|
|
24
|
-
def entity_id(self) ->
|
|
24
|
+
def entity_id(self) -> Optional[str]:
|
|
25
25
|
"""
|
|
26
26
|
The entity id of the menu item.
|
|
27
27
|
|
|
28
28
|
Returns:
|
|
29
|
-
(
|
|
29
|
+
(Optional[str]): The entity id of the menu item.
|
|
30
30
|
"""
|
|
31
31
|
return self._raw_item_data["id"]
|
|
32
32
|
|
|
33
33
|
@json_property
|
|
34
|
-
def pc_short_name(self) ->
|
|
34
|
+
def pc_short_name(self) -> Optional[str]:
|
|
35
35
|
"""
|
|
36
36
|
The short name of the menu item.
|
|
37
37
|
|
|
38
38
|
Returns:
|
|
39
|
-
(
|
|
39
|
+
(Optional[str]): The short name of the menu item.
|
|
40
40
|
"""
|
|
41
41
|
return self._raw_item_data["names"]["PCShort"]
|
|
42
42
|
|
|
43
43
|
@json_property
|
|
44
|
-
def pc_long_name(self) ->
|
|
44
|
+
def pc_long_name(self) -> Optional[str]:
|
|
45
45
|
"""
|
|
46
46
|
The long name of the menu item.
|
|
47
47
|
|
|
48
48
|
Returns:
|
|
49
|
-
(
|
|
49
|
+
(Optional[str]): The long name of the menu item.
|
|
50
50
|
"""
|
|
51
51
|
return self._raw_item_data["names"]["PCLong"]
|
|
52
52
|
|
|
53
53
|
@json_property
|
|
54
|
-
def mobile_short_name(self) ->
|
|
54
|
+
def mobile_short_name(self) -> Optional[str]:
|
|
55
55
|
"""
|
|
56
56
|
The short name of the menu item.
|
|
57
57
|
|
|
58
58
|
Returns:
|
|
59
|
-
(
|
|
59
|
+
(Optional[str]): The short name of the menu item.
|
|
60
60
|
"""
|
|
61
61
|
return self._raw_item_data["names"]["MobileShort"]
|
|
62
62
|
|
|
63
63
|
@json_property
|
|
64
|
-
def mobile_long_name(self) ->
|
|
64
|
+
def mobile_long_name(self) -> Optional[str]:
|
|
65
65
|
"""
|
|
66
66
|
The long name of the menu item.
|
|
67
67
|
|
|
68
68
|
Returns:
|
|
69
|
-
(
|
|
69
|
+
(Optional[str]): The long name of the menu item.
|
|
70
70
|
"""
|
|
71
71
|
return self._raw_item_data["names"]["MobileLong"]
|
|
72
72
|
|
|
73
73
|
@json_property
|
|
74
|
-
def mickey_check(self) ->
|
|
74
|
+
def mickey_check(self) -> Optional[bool]:
|
|
75
75
|
"""
|
|
76
76
|
Whether the menu item is mickey check.
|
|
77
77
|
|
|
78
78
|
Returns:
|
|
79
|
-
(
|
|
79
|
+
(Optional[bool]): Whether the menu item is mickey check.
|
|
80
80
|
"""
|
|
81
81
|
return self._raw_item_data["mickeyCheck"]
|
|
82
82
|
|
|
83
83
|
@json_property
|
|
84
|
-
def pc_long_description(self) ->
|
|
84
|
+
def pc_long_description(self) -> Optional[str]:
|
|
85
85
|
"""
|
|
86
86
|
The long description of the menu item.
|
|
87
87
|
|
|
88
88
|
Returns:
|
|
89
|
-
(
|
|
89
|
+
(Optional[str]): The long description of the menu item.
|
|
90
90
|
"""
|
|
91
91
|
return self._raw_item_data["descriptions"]["PCLong"]["text"]
|
|
92
92
|
|
|
93
93
|
@json_property
|
|
94
|
-
def mobile_short_description(self) ->
|
|
94
|
+
def mobile_short_description(self) -> Optional[str]:
|
|
95
95
|
"""
|
|
96
96
|
The short description of the menu item.
|
|
97
97
|
|
|
98
98
|
Returns:
|
|
99
|
-
(
|
|
99
|
+
(Optional[str]): The short description of the menu item.
|
|
100
100
|
"""
|
|
101
101
|
return self._raw_item_data["descriptions"]["MobileShort"]["text"]
|
|
102
102
|
|
|
103
103
|
@json_property
|
|
104
|
-
def default_selection(self) ->
|
|
104
|
+
def default_selection(self) -> Optional[bool]:
|
|
105
105
|
"""
|
|
106
106
|
Whether the menu item is the default selection.
|
|
107
107
|
|
|
108
108
|
Returns:
|
|
109
|
-
(
|
|
109
|
+
(Optional[bool]): Whether the menu item is the default selection.
|
|
110
110
|
"""
|
|
111
111
|
return self._raw_item_data["defaultSelection"]
|
|
112
112
|
|
|
113
113
|
@json_property
|
|
114
|
-
def prices(self) ->
|
|
114
|
+
def prices(self) -> Optional[dict]:
|
|
115
115
|
"""
|
|
116
116
|
The prices of the menu item.
|
|
117
117
|
|
|
118
118
|
Returns:
|
|
119
|
-
(
|
|
119
|
+
(Optional[dict]): The prices of the menu item.
|
|
120
120
|
"""
|
|
121
121
|
return self._raw_item_data["prices"]
|
|
122
122
|
|
|
123
123
|
@json_property
|
|
124
|
-
def per_serving_without_tax(self) ->
|
|
124
|
+
def per_serving_without_tax(self) -> Optional[float]:
|
|
125
125
|
"""
|
|
126
126
|
The per serving without tax of the menu item.
|
|
127
127
|
|
|
128
128
|
Returns:
|
|
129
|
-
(
|
|
129
|
+
(Optional[float]): The per serving without tax of the menu item.
|
|
130
130
|
"""
|
|
131
131
|
return self._raw_item_data["prices"]["PerServing"]["withoutTax"]
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
class MenuGroup:
|
|
135
|
-
def __init__(self, raw_menu_group_data: dict, parent_restaurant_id:
|
|
135
|
+
def __init__(self, raw_menu_group_data: dict, parent_restaurant_id: Optional[str] = None) -> None:
|
|
136
136
|
self._raw_menu_group_data = raw_menu_group_data
|
|
137
137
|
self._parent_restaurant_id = parent_restaurant_id
|
|
138
138
|
|
|
@@ -140,92 +140,92 @@ class MenuGroup:
|
|
|
140
140
|
return f"MenuGroup(menu_group_type={self.menu_group_type}, parent_restaurant_id={self._parent_restaurant_id})"
|
|
141
141
|
|
|
142
142
|
@json_property
|
|
143
|
-
def menu_group_type(self) ->
|
|
143
|
+
def menu_group_type(self) -> Optional[str]:
|
|
144
144
|
"""
|
|
145
145
|
The type of the menu group.
|
|
146
146
|
|
|
147
147
|
Returns:
|
|
148
|
-
(
|
|
148
|
+
(Optional[str]): The type of the menu group.
|
|
149
149
|
"""
|
|
150
150
|
return self._raw_menu_group_data["menuGroupType"]
|
|
151
151
|
|
|
152
152
|
@json_property
|
|
153
|
-
def multiple_price_types(self) ->
|
|
153
|
+
def multiple_price_types(self) -> Optional[bool]:
|
|
154
154
|
"""
|
|
155
155
|
Whether the menu group has multiple price types.
|
|
156
156
|
|
|
157
157
|
Returns:
|
|
158
|
-
(
|
|
158
|
+
(Optional[bool]): Whether the menu group has multiple price types.
|
|
159
159
|
"""
|
|
160
160
|
return self._raw_menu_group_data["multiplePriceTypes"]
|
|
161
161
|
|
|
162
162
|
@json_property
|
|
163
|
-
def mickey_check_items(self) ->
|
|
163
|
+
def mickey_check_items(self) -> Optional[bool]:
|
|
164
164
|
"""
|
|
165
165
|
Whether the menu group has mickey check items.
|
|
166
166
|
|
|
167
167
|
Returns:
|
|
168
|
-
(
|
|
168
|
+
(Optional[bool]): Whether the menu group has mickey check items.
|
|
169
169
|
"""
|
|
170
170
|
return self._raw_menu_group_data["mickeyCheckItems"]
|
|
171
171
|
|
|
172
172
|
@json_property
|
|
173
|
-
def names(self) ->
|
|
173
|
+
def names(self) -> Optional[dict]:
|
|
174
174
|
"""
|
|
175
175
|
The names of the menu group.
|
|
176
176
|
|
|
177
177
|
Returns:
|
|
178
|
-
(
|
|
178
|
+
(Optional[dict]): The names of the menu group.
|
|
179
179
|
"""
|
|
180
180
|
return self._raw_menu_group_data["names"]
|
|
181
181
|
|
|
182
182
|
@json_property
|
|
183
|
-
def pc_short_name(self) ->
|
|
183
|
+
def pc_short_name(self) -> Optional[str]:
|
|
184
184
|
"""
|
|
185
185
|
The short name of the menu group.
|
|
186
186
|
|
|
187
187
|
Returns:
|
|
188
|
-
(
|
|
188
|
+
(Optional[str]): The short name of the menu group.
|
|
189
189
|
"""
|
|
190
190
|
return self._raw_menu_group_data["names"]["PCShort"]
|
|
191
191
|
|
|
192
192
|
@json_property
|
|
193
|
-
def pc_long_name(self) ->
|
|
193
|
+
def pc_long_name(self) -> Optional[str]:
|
|
194
194
|
"""
|
|
195
195
|
The long name of the menu group.
|
|
196
196
|
|
|
197
197
|
Returns:
|
|
198
|
-
(
|
|
198
|
+
(Optional[str]): The long name of the menu group.
|
|
199
199
|
"""
|
|
200
200
|
return self._raw_menu_group_data["names"]["PCLong"]
|
|
201
201
|
|
|
202
202
|
@json_property
|
|
203
|
-
def mobile_short_name(self) ->
|
|
203
|
+
def mobile_short_name(self) -> Optional[str]:
|
|
204
204
|
"""
|
|
205
205
|
The short name of the menu group.
|
|
206
206
|
|
|
207
207
|
Returns:
|
|
208
|
-
(
|
|
208
|
+
(Optional[str]): The short name of the menu group.
|
|
209
209
|
"""
|
|
210
210
|
return self._raw_menu_group_data["names"]["MobileShort"]
|
|
211
211
|
|
|
212
212
|
@json_property
|
|
213
|
-
def mobile_long_name(self) ->
|
|
213
|
+
def mobile_long_name(self) -> Optional[str]:
|
|
214
214
|
"""
|
|
215
215
|
The long name of the menu group.
|
|
216
216
|
|
|
217
217
|
Returns:
|
|
218
|
-
(
|
|
218
|
+
(Optional[str]): The long name of the menu group.
|
|
219
219
|
"""
|
|
220
220
|
return self._raw_menu_group_data["names"]["MobileLong"]
|
|
221
221
|
|
|
222
222
|
@property
|
|
223
|
-
def menu_items(self) ->
|
|
223
|
+
def menu_items(self) -> Optional[list[MenuItem]]:
|
|
224
224
|
"""
|
|
225
225
|
The menu items of the menu group.
|
|
226
226
|
|
|
227
227
|
Returns:
|
|
228
|
-
(
|
|
228
|
+
(Optional[list[MenuItem]]): The menu items of the menu group.
|
|
229
229
|
"""
|
|
230
230
|
try:
|
|
231
231
|
return [MenuItem(i, self._parent_restaurant_id) for i in self._raw_menu_group_data["menuItems"]]
|
|
@@ -234,80 +234,80 @@ class MenuGroup:
|
|
|
234
234
|
|
|
235
235
|
|
|
236
236
|
class Menu:
|
|
237
|
-
def __init__(self, raw_menu_data: dict, parent_restaurant_id:
|
|
237
|
+
def __init__(self, raw_menu_data: dict, parent_restaurant_id: Optional[str] = None) -> None:
|
|
238
238
|
self._raw_menu_data = raw_menu_data
|
|
239
239
|
self._parent_restaurant_id = parent_restaurant_id
|
|
240
240
|
|
|
241
|
-
def __str__(self):
|
|
241
|
+
def __str__(self) -> str:
|
|
242
242
|
return f"Menu(entity_id={self.entity_id}, menu_type={self.menu_type}, parent_restaurant_id={self._parent_restaurant_id})"
|
|
243
243
|
|
|
244
244
|
@json_property
|
|
245
|
-
def entity_id(self) ->
|
|
245
|
+
def entity_id(self) -> Optional[str]:
|
|
246
246
|
"""
|
|
247
247
|
The entity id of the menu.
|
|
248
248
|
|
|
249
249
|
Returns:
|
|
250
|
-
(
|
|
250
|
+
(Optional[str]): The entity id of the menu.
|
|
251
251
|
"""
|
|
252
252
|
return self._raw_menu_data["id"]
|
|
253
253
|
|
|
254
254
|
@json_property
|
|
255
|
-
def menu_type(self) ->
|
|
255
|
+
def menu_type(self) -> Optional[str]:
|
|
256
256
|
"""
|
|
257
257
|
The type of the menu.
|
|
258
258
|
|
|
259
259
|
Returns:
|
|
260
|
-
(
|
|
260
|
+
(Optional[str]): The type of the menu.
|
|
261
261
|
"""
|
|
262
262
|
return self._raw_menu_data["menuType"]
|
|
263
263
|
|
|
264
264
|
@json_property
|
|
265
|
-
def localized_menu_type(self) ->
|
|
265
|
+
def localized_menu_type(self) -> Optional[str]:
|
|
266
266
|
"""
|
|
267
267
|
The localized type of the menu.
|
|
268
268
|
|
|
269
269
|
Returns:
|
|
270
|
-
(
|
|
270
|
+
(Optional[str]): The localized type of the menu.
|
|
271
271
|
"""
|
|
272
272
|
return self._raw_menu_data["localizedMenuType"]
|
|
273
273
|
|
|
274
274
|
@json_property
|
|
275
|
-
def experience_type(self) ->
|
|
275
|
+
def experience_type(self) -> Optional[str]:
|
|
276
276
|
"""
|
|
277
277
|
The experience type of the menu.
|
|
278
278
|
|
|
279
279
|
Returns:
|
|
280
|
-
(
|
|
280
|
+
(Optional[str]): The experience type of the menu.
|
|
281
281
|
"""
|
|
282
282
|
return self._raw_menu_data["experienceType"]
|
|
283
283
|
|
|
284
284
|
@json_property
|
|
285
|
-
def service_style(self) ->
|
|
285
|
+
def service_style(self) -> Optional[str]:
|
|
286
286
|
"""
|
|
287
287
|
The service style of the menu.
|
|
288
288
|
|
|
289
289
|
Returns:
|
|
290
|
-
(
|
|
290
|
+
(Optional[str]): The service style of the menu.
|
|
291
291
|
"""
|
|
292
292
|
return self._raw_menu_data["serviceStyle"]
|
|
293
293
|
|
|
294
294
|
@json_property
|
|
295
|
-
def primary_cuisine_type(self) ->
|
|
295
|
+
def primary_cuisine_type(self) -> Optional[str]:
|
|
296
296
|
"""
|
|
297
297
|
The primary cuisine type of the menu.
|
|
298
298
|
|
|
299
299
|
Returns:
|
|
300
|
-
(
|
|
300
|
+
(Optional[str]): The primary cuisine type of the menu.
|
|
301
301
|
"""
|
|
302
302
|
return self._raw_menu_data["primaryCuisineType"]
|
|
303
303
|
|
|
304
304
|
@json_property
|
|
305
|
-
def secondary_cuisine_type(self) ->
|
|
305
|
+
def secondary_cuisine_type(self) -> Optional[str]:
|
|
306
306
|
"""
|
|
307
307
|
The secondary cuisine type of the menu.
|
|
308
308
|
|
|
309
309
|
Returns:
|
|
310
|
-
(
|
|
310
|
+
(Optional[str]): The secondary cuisine type of the menu.
|
|
311
311
|
"""
|
|
312
312
|
return self._raw_menu_data["secondaryCuisineType"]
|
|
313
313
|
|
|
@@ -330,7 +330,7 @@ class Menus(DisneyAPIMixin):
|
|
|
330
330
|
|
|
331
331
|
_menu_service_base = f"{auth_obj._environments['serviceMenuUrl']}/diningMenuSvc/orchestration/menus"
|
|
332
332
|
|
|
333
|
-
def __init__(self, restaurant_channel_id: str, lazy_load: bool = True):
|
|
333
|
+
def __init__(self, restaurant_channel_id: str, lazy_load: bool = True) -> None:
|
|
334
334
|
self.entity_id = restaurant_channel_id.rsplit(".", 1)[-1]
|
|
335
335
|
self._menu_service_url = f"{self._menu_service_base}/{self.entity_id}"
|
|
336
336
|
|
|
@@ -339,15 +339,15 @@ class Menus(DisneyAPIMixin):
|
|
|
339
339
|
) # properties are rarely updated, no need to spam the API
|
|
340
340
|
self._tz = ZoneInfo("UTC")
|
|
341
341
|
|
|
342
|
-
self._disney_data:
|
|
342
|
+
self._disney_data: Optional[dict] = None
|
|
343
343
|
self._disney_data_pull_time: datetime = datetime.now(tz=self._tz)
|
|
344
344
|
if not lazy_load:
|
|
345
345
|
self.refresh()
|
|
346
346
|
|
|
347
|
-
def __str__(self):
|
|
347
|
+
def __str__(self) -> str:
|
|
348
348
|
return f"Menus(entity_id={self.entity_id})"
|
|
349
349
|
|
|
350
|
-
def __repr__(self):
|
|
350
|
+
def __repr__(self) -> str:
|
|
351
351
|
return f"Menus(restaurant_channel_id={self.entity_id})"
|
|
352
352
|
|
|
353
353
|
def refresh(self) -> None:
|
|
@@ -378,42 +378,42 @@ class Menus(DisneyAPIMixin):
|
|
|
378
378
|
return [Menu(i, self.entity_id) for i in self._disney_data["menus"]]
|
|
379
379
|
|
|
380
380
|
@disney_property()
|
|
381
|
-
def facility_name(self) ->
|
|
381
|
+
def facility_name(self) -> Optional[str]:
|
|
382
382
|
"""
|
|
383
383
|
The name of the facility.
|
|
384
384
|
|
|
385
385
|
Returns:
|
|
386
|
-
(
|
|
386
|
+
(Optional[str]): The name of the facility.
|
|
387
387
|
"""
|
|
388
388
|
return self._disney_data["facilityName"]
|
|
389
389
|
|
|
390
390
|
@disney_property()
|
|
391
|
-
def ancestor_location_park_resort(self) ->
|
|
391
|
+
def ancestor_location_park_resort(self) -> Optional[str]:
|
|
392
392
|
"""
|
|
393
393
|
The name of the ancestor location.
|
|
394
394
|
|
|
395
395
|
Returns:
|
|
396
|
-
(
|
|
396
|
+
(Optional[str]): The name of the ancestor location.
|
|
397
397
|
"""
|
|
398
398
|
return self._disney_data["ancestorLocationParkResort"]
|
|
399
399
|
|
|
400
400
|
@disney_property()
|
|
401
|
-
def ancestor_location_land_area(self) ->
|
|
401
|
+
def ancestor_location_land_area(self) -> Optional[str]:
|
|
402
402
|
"""
|
|
403
403
|
The name of the ancestor location.
|
|
404
404
|
|
|
405
405
|
Returns:
|
|
406
|
-
(
|
|
406
|
+
(Optional[str]): The name of the ancestor location.
|
|
407
407
|
"""
|
|
408
408
|
return self._disney_data["ancestorLocationLandArea"]
|
|
409
409
|
|
|
410
410
|
@disney_property()
|
|
411
|
-
def last_refresh(self) ->
|
|
411
|
+
def last_refresh(self) -> Optional[datetime]:
|
|
412
412
|
"""
|
|
413
413
|
The last time the menus were refreshed.
|
|
414
414
|
|
|
415
415
|
Returns:
|
|
416
|
-
(
|
|
416
|
+
(Optional[datetime]): The last time the menus were refreshed.
|
|
417
417
|
"""
|
|
418
418
|
refresh_time = isoparse(self._disney_data["lastRefresh"])
|
|
419
419
|
refresh_time = refresh_time.replace(tzinfo=self._tz)
|
|
@@ -9,7 +9,7 @@ from mousetools.mixins.disney import DisneyAPIMixin
|
|
|
9
9
|
class Search(DisneyAPIMixin):
|
|
10
10
|
_search_service_base = auth_obj._environments["searchServiceUrl"]
|
|
11
11
|
|
|
12
|
-
def __init__(self, destination: Union[DestinationShort, str]):
|
|
12
|
+
def __init__(self, destination: Union[DestinationShort, str]) -> None:
|
|
13
13
|
"""
|
|
14
14
|
Args:
|
|
15
15
|
destination (Union[DestinationShort, str]): Search the facilities for this destination
|
|
@@ -54,5 +54,5 @@ class Search(DisneyAPIMixin):
|
|
|
54
54
|
"""
|
|
55
55
|
return self.search(*args, **kwargs)
|
|
56
56
|
|
|
57
|
-
def __repr__(self):
|
|
57
|
+
def __repr__(self) -> str:
|
|
58
58
|
return f"Search(destination='{self.destination}')"
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
|
-
import typing
|
|
5
4
|
from datetime import datetime, timedelta
|
|
6
5
|
from importlib.resources import as_file, files
|
|
6
|
+
from typing import Optional
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import requests
|
|
9
9
|
from Crypto.Cipher import AES
|
|
10
10
|
|
|
11
11
|
logger = logging.getLogger(__name__)
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Authentication:
|
|
15
|
-
def __init__(self):
|
|
16
|
-
self.time_of_expire:
|
|
17
|
-
self.access_token:
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
self.time_of_expire: Optional[datetime] = None
|
|
17
|
+
self.access_token: Optional[str] = None
|
|
18
18
|
self._environments = self._decrypt_file("resources/environments.bin").get("production", {})
|
|
19
19
|
|
|
20
20
|
def authenticate(self) -> tuple[str, int]:
|
|
@@ -42,7 +42,7 @@ class Authentication:
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
logger.debug("Sending request for authentication token")
|
|
45
|
-
response =
|
|
45
|
+
response = requests.post(
|
|
46
46
|
f"{self._environments['authzServiceUrl']}/token",
|
|
47
47
|
headers=headers,
|
|
48
48
|
params=body,
|
|
@@ -100,7 +100,7 @@ class Authentication:
|
|
|
100
100
|
decrypted = cipher.decrypt(file.read())
|
|
101
101
|
return json.loads(decrypted.decode("Windows-1252")[:-16])
|
|
102
102
|
|
|
103
|
-
def _e(self):
|
|
103
|
+
def _e(self) -> bytes:
|
|
104
104
|
s = ""
|
|
105
105
|
for i in range(1, 17):
|
|
106
106
|
if i % 2 != 0 or i >= 16:
|
|
@@ -110,7 +110,7 @@ class Authentication:
|
|
|
110
110
|
bytes_ = s.encode("utf-8")
|
|
111
111
|
return bytes_
|
|
112
112
|
|
|
113
|
-
def _b(self):
|
|
113
|
+
def _b(self) -> bytes:
|
|
114
114
|
return bytes(reversed(self._e()))
|
|
115
115
|
|
|
116
116
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
import typing
|
|
3
2
|
from datetime import datetime, timedelta
|
|
4
3
|
from enum import Enum
|
|
4
|
+
from typing import Any, Optional, Union
|
|
5
5
|
|
|
6
6
|
from dateutil.parser import isoparse
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ logger = logging.getLogger(__name__)
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class CouchbaseChildChannel(CouchbaseMixin):
|
|
17
|
-
def __init__(self, channel_id: str, lazy_load: bool = True):
|
|
17
|
+
def __init__(self, channel_id: str, lazy_load: bool = True) -> None:
|
|
18
18
|
if isinstance(channel_id, Enum):
|
|
19
19
|
channel_id = channel_id.value
|
|
20
20
|
|
|
@@ -28,7 +28,7 @@ class CouchbaseChildChannel(CouchbaseMixin):
|
|
|
28
28
|
else DestinationTimezones.DISNEYLAND_RESORT
|
|
29
29
|
)
|
|
30
30
|
self._refresh_interval: timedelta = timedelta(hours=12)
|
|
31
|
-
self._cb_data:
|
|
31
|
+
self._cb_data: Optional[dict] = None
|
|
32
32
|
self._cb_data_pull_time: datetime = datetime.now(tz=self._tz.value)
|
|
33
33
|
if not lazy_load:
|
|
34
34
|
self.refresh()
|
|
@@ -48,12 +48,12 @@ class CouchbaseChildChannel(CouchbaseMixin):
|
|
|
48
48
|
self._cb_data_pull_time = datetime.now(tz=self._tz.value)
|
|
49
49
|
|
|
50
50
|
@disney_property()
|
|
51
|
-
def last_update(self) ->
|
|
51
|
+
def last_update(self) -> Optional[datetime]:
|
|
52
52
|
"""
|
|
53
53
|
The last time disney updated the data.
|
|
54
54
|
|
|
55
55
|
Returns:
|
|
56
|
-
(
|
|
56
|
+
(Optional[datetime]): The last time the entity's data was updated, or None if no such data exists.
|
|
57
57
|
"""
|
|
58
58
|
dt = isoparse(self._cb_data["lastUpdate"])
|
|
59
59
|
dt = dt.replace(tzinfo=self._tz.value)
|
|
@@ -61,10 +61,10 @@ class CouchbaseChildChannel(CouchbaseMixin):
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
class CouchbaseChannel(CouchbaseMixin):
|
|
64
|
-
def __init__(self, channel_id:
|
|
64
|
+
def __init__(self, channel_id: Union[WDWCouchbaseChannels, DLRCouchbaseChannels], lazy_load: bool = True) -> None:
|
|
65
65
|
"""
|
|
66
66
|
Args:
|
|
67
|
-
channel_id (
|
|
67
|
+
channel_id (Union[WDWCouchbaseChannels, DLRCouchbaseChannels]): Channel ID from the enum
|
|
68
68
|
lazy_load (bool, optional): If True, will not pull data until a method or property is called. Defaults to True.
|
|
69
69
|
"""
|
|
70
70
|
if isinstance(channel_id, Enum):
|
|
@@ -107,7 +107,18 @@ class CouchbaseChannel(CouchbaseMixin):
|
|
|
107
107
|
|
|
108
108
|
return [i["id"] for i in self._cb_data["results"]]
|
|
109
109
|
|
|
110
|
-
def _get_children_objects_helper(
|
|
110
|
+
def _get_children_objects_helper(
|
|
111
|
+
self, class_obj: CouchbaseChildChannel, entity_type: EntityType
|
|
112
|
+
) -> list[CouchbaseChildChannel]:
|
|
113
|
+
"""Searches through the couchbase data for the given entity type and returns an instanct of the given class obj
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
class_obj (CouchbaseChildChannel): A reference to a child channel class that will be used to instantiate the object. E.g. FacilitiesChildChannel, FacilityStatusChildChannel. etc.
|
|
117
|
+
entity_type (EntityType): The entity type to look for in the results.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
list[CouchbaseChildChannel]: A list of instantiated objects with the same type as given in class_obj.
|
|
121
|
+
"""
|
|
111
122
|
self.refresh()
|
|
112
123
|
channels = []
|
|
113
124
|
check_for = f"entitytype={entity_type.value}".lower()
|
|
@@ -116,10 +127,10 @@ class CouchbaseChannel(CouchbaseMixin):
|
|
|
116
127
|
channels.append(class_obj(i["id"]))
|
|
117
128
|
return channels
|
|
118
129
|
|
|
119
|
-
def __repr__(self):
|
|
130
|
+
def __repr__(self) -> str:
|
|
120
131
|
return f"{self.__class__.__name__}(channel_id='{self.channel_id}')"
|
|
121
132
|
|
|
122
|
-
def __eq__(self, other) -> bool:
|
|
133
|
+
def __eq__(self, other: Any) -> bool:
|
|
123
134
|
if isinstance(other, CouchbaseChannel):
|
|
124
135
|
return self.channel_id == other.channel_id
|
|
125
136
|
return False
|