MouseTools 3.0.0.dev2__tar.gz → 3.1.0.dev2__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.
Files changed (42) hide show
  1. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2/MouseTools.egg-info}/PKG-INFO +2 -1
  2. {mousetools-3.0.0.dev2/MouseTools.egg-info → mousetools-3.1.0.dev2}/PKG-INFO +2 -1
  3. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/__init__.py +1 -1
  4. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/__init__.py +2 -0
  5. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/base.py +20 -19
  6. mousetools-3.1.0.dev2/mousetools/entities/menu.py +226 -0
  7. mousetools-3.1.0.dev2/mousetools/entities/restaurant.py +53 -0
  8. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/mixins/disney.py +2 -2
  9. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/pyproject.toml +62 -34
  10. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/tests/test_entities.py +4 -1
  11. mousetools-3.0.0.dev2/mousetools/entities/menu.py +0 -12
  12. mousetools-3.0.0.dev2/mousetools/entities/restaurant.py +0 -12
  13. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/LICENSE +0 -0
  14. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/MouseTools.egg-info/SOURCES.txt +0 -0
  15. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/MouseTools.egg-info/dependency_links.txt +0 -0
  16. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/MouseTools.egg-info/requires.txt +0 -0
  17. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/MouseTools.egg-info/top_level.txt +0 -0
  18. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/README.md +0 -0
  19. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/auth.py +0 -0
  20. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/attraction.py +0 -0
  21. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/character.py +0 -0
  22. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/destination.py +0 -0
  23. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/dining_event.py +0 -0
  24. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/dinner_show.py +0 -0
  25. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/entertainment.py +0 -0
  26. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/entertainment_venue.py +0 -0
  27. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/event.py +0 -0
  28. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/guest_services.py +0 -0
  29. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/land.py +0 -0
  30. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/merchandise_facility.py +0 -0
  31. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/park.py +0 -0
  32. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/point_of_interest.py +0 -0
  33. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/resort.py +0 -0
  34. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/entities/resort_area.py +0 -0
  35. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/exceptions.py +0 -0
  36. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/ids.py +0 -0
  37. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/mixins/__init__.py +0 -0
  38. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/mixins/themeparksapi.py +0 -0
  39. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/mousetools/urls.py +0 -0
  40. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/setup.cfg +0 -0
  41. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/tests/test_auth.py +0 -0
  42. {mousetools-3.0.0.dev2 → mousetools-3.1.0.dev2}/tests/test_ids.py +0 -0
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MouseTools
3
- Version: 3.0.0.dev2
3
+ Version: 3.1.0.dev2
4
4
  Summary: An unofficial Python wrapper for Disney's API
5
5
  Author: Scott Caratozzolo
6
6
  Project-URL: repository, https://gitlab.com/caratozzoloxyz/public/MouseTools
7
+ Project-URL: documentation, https://caratozzoloxyz.gitlab.io/public/MouseTools/
7
8
  Classifier: Programming Language :: Python :: 3
8
9
  Classifier: License :: OSI Approved :: MIT License
9
10
  Classifier: Operating System :: OS Independent
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MouseTools
3
- Version: 3.0.0.dev2
3
+ Version: 3.1.0.dev2
4
4
  Summary: An unofficial Python wrapper for Disney's API
5
5
  Author: Scott Caratozzolo
6
6
  Project-URL: repository, https://gitlab.com/caratozzoloxyz/public/MouseTools
7
+ Project-URL: documentation, https://caratozzoloxyz.gitlab.io/public/MouseTools/
7
8
  Classifier: Programming Language :: Python :: 3
8
9
  Classifier: License :: OSI Approved :: MIT License
9
10
  Classifier: Operating System :: OS Independent
@@ -3,5 +3,5 @@ import logging
3
3
  logger = logging.getLogger(__name__)
4
4
  logger.addHandler(logging.NullHandler())
5
5
 
6
- __version__ = "3.0.0-dev.2" # will be set at runtime
6
+ __version__ = "3.1.0-dev.2" # will be set at runtime
7
7
  logger.info(f"MouseTools version: {__version__}")
@@ -8,6 +8,7 @@ from mousetools.entities.entertainment_venue import EntertainmentVenue
8
8
  from mousetools.entities.event import Event
9
9
  from mousetools.entities.guest_services import GuestServices
10
10
  from mousetools.entities.land import Land
11
+ from mousetools.entities.menu import Menus
11
12
  from mousetools.entities.merchandise_facility import MerchandiseFacility
12
13
  from mousetools.entities.park import ThemePark, WaterPark
13
14
  from mousetools.entities.point_of_interest import PointOfInterest
@@ -38,4 +39,5 @@ __all__ = [
38
39
  "Event",
39
40
  "Land",
40
41
  "PointOfInterest",
42
+ "Menus",
41
43
  ]
@@ -23,7 +23,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
23
23
 
24
24
  if isinstance(facility_service_entity_type, FacilityServiceEntityTypes):
25
25
  facility_service_entity_type = facility_service_entity_type.value
26
- self.__facility_service_url = f"{WDPRO_FACILITY_SERVICE_BASE_URL}/{facility_service_entity_type}/{self.entity_id}"
26
+ self._facility_service_url = f"{WDPRO_FACILITY_SERVICE_BASE_URL}/{facility_service_entity_type}/{self.entity_id}"
27
27
 
28
28
  @property
29
29
  def name(self) -> typing.Optional[str]:
@@ -35,7 +35,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
35
35
  """
36
36
 
37
37
  if self.disney_data is None:
38
- self.disney_data = self.get_disney_data(self.__facility_service_url)
38
+ self.disney_data = self.get_disney_data(self._facility_service_url)
39
39
  try:
40
40
  return self.disney_data["name"]
41
41
  except KeyError:
@@ -52,7 +52,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
52
52
  """
53
53
 
54
54
  if self.disney_data is None:
55
- self.disney_data = self.get_disney_data(self.__facility_service_url)
55
+ self.disney_data = self.get_disney_data(self._facility_service_url)
56
56
  try:
57
57
  return self.disney_data["type"]
58
58
  except KeyError:
@@ -68,7 +68,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
68
68
  (typing.Optional[str]): The sub type of entity, or None if it was not found.
69
69
  """
70
70
  if self.disney_data is None:
71
- self.disney_data = self.get_disney_data(self.__facility_service_url)
71
+ self.disney_data = self.get_disney_data(self._facility_service_url)
72
72
  try:
73
73
  return self.disney_data["subType"]
74
74
  except KeyError:
@@ -84,7 +84,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
84
84
  (typing.Optional[str]): The url friendly id of the entity, or None if not found.
85
85
  """
86
86
  if self.disney_data is None:
87
- self.disney_data = self.get_disney_data(self.__facility_service_url)
87
+ self.disney_data = self.get_disney_data(self._facility_service_url)
88
88
  try:
89
89
  _id = self.disney_data["urlFriendlyId"]
90
90
  return _id
@@ -101,21 +101,22 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
101
101
  (typing.Optional[dict[str, float]]): A dict with "lat" and "lng" keys containing the coordinates of this entity as floats, or None if no coordinates are found
102
102
  """
103
103
  if self.disney_data is None:
104
- self.disney_data = self.get_disney_data(self.__facility_service_url)
104
+ self.disney_data = self.get_disney_data(self._facility_service_url)
105
105
  try:
106
106
  return {
107
107
  "lat": float(
108
108
  self.disney_data["coordinates"]["Guest Entrance"]["gps"][
109
- "lattitude"
109
+ "latitude"
110
110
  ]
111
111
  ),
112
112
  "lng": float(
113
- self.disney_data["coordinates"]["Guest entrance"]["gps"][
113
+ self.disney_data["coordinates"]["Guest Entrance"]["gps"][
114
114
  "longitude"
115
115
  ]
116
116
  ),
117
117
  }
118
- except KeyError:
118
+ except KeyError as e:
119
+ print(e)
119
120
  logger.debug("No coordinates found for %s", self.entity_id)
120
121
  return None
121
122
 
@@ -129,7 +130,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
129
130
  """
130
131
  # TODO check other ancestors to guess dest if not found
131
132
  if self.disney_data is None:
132
- self.disney_data = self.get_disney_data(self.__facility_service_url)
133
+ self.disney_data = self.get_disney_data(self._facility_service_url)
133
134
  try:
134
135
  return (
135
136
  self.disney_data["links"]["ancestorDestination"]["href"]
@@ -156,7 +157,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
156
157
  (typing.Optional[str]): Theme park id, or None if no such id is found.
157
158
  """
158
159
  if self.disney_data is None:
159
- self.disney_data = self.get_disney_data(self.__facility_service_url)
160
+ self.disney_data = self.get_disney_data(self._facility_service_url)
160
161
  try:
161
162
  return (
162
163
  self.disney_data["links"]["ancestorThemePark"]["href"]
@@ -176,7 +177,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
176
177
  (typing.Optional[str]): Water park id, or None if no such id is found.
177
178
  """
178
179
  if self.disney_data is None:
179
- self.disney_data = self.get_disney_data(self.__facility_service_url)
180
+ self.disney_data = self.get_disney_data(self._facility_service_url)
180
181
  try:
181
182
  return (
182
183
  self.disney_data["links"]["ancestorWaterPark"]["href"]
@@ -197,7 +198,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
197
198
  """
198
199
 
199
200
  if self.disney_data is None:
200
- self.disney_data = self.get_disney_data(self.__facility_service_url)
201
+ self.disney_data = self.get_disney_data(self._facility_service_url)
201
202
  try:
202
203
  return (
203
204
  self.disney_data["links"]["ancestorResort"]["href"]
@@ -217,7 +218,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
217
218
  (typing.Optional[str]): Land id, or None if no such id is found.
218
219
  """
219
220
  if self.disney_data is None:
220
- self.disney_data = self.get_disney_data(self.__facility_service_url)
221
+ self.disney_data = self.get_disney_data(self._facility_service_url)
221
222
  try:
222
223
  return (
223
224
  self.disney_data["links"]["ancestorLand"]["href"]
@@ -237,7 +238,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
237
238
  (typing.Optional[str]): Resort area id, or None if no such id is found.
238
239
  """
239
240
  if self.disney_data is None:
240
- self.disney_data = self.get_disney_data(self.__facility_service_url)
241
+ self.disney_data = self.get_disney_data(self._facility_service_url)
241
242
  try:
242
243
  return (
243
244
  self.disney_data["links"]["ancestorResortArea"]["href"]
@@ -257,7 +258,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
257
258
  (typing.Optional[str]): Entertainment venue id, or None if no such id is found.
258
259
  """
259
260
  if self.disney_data is None:
260
- self.disney_data = self.get_disney_data(self.__facility_service_url)
261
+ self.disney_data = self.get_disney_data(self._facility_service_url)
261
262
  try:
262
263
  return (
263
264
  self.disney_data["links"]["ancestorEntertainmentVenue"]["href"]
@@ -279,7 +280,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
279
280
  (typing.Optional[str]): Restaurant id, or None if no such id is found.
280
281
  """
281
282
  if self.disney_data is None:
282
- self.disney_data = self.get_disney_data(self.__facility_service_url)
283
+ self.disney_data = self.get_disney_data(self._facility_service_url)
283
284
  try:
284
285
  return (
285
286
  self.disney_data["links"]["ancestorRestaurant"]["href"]
@@ -322,7 +323,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
322
323
  @property
323
324
  def duration(self) -> typing.Optional[time]:
324
325
  if self.disney_data is None:
325
- self.disney_data = self.get_disney_data(self.__facility_service_url)
326
+ self.disney_data = self.get_disney_data(self._facility_service_url)
326
327
  try:
327
328
  return time.fromisoformat(
328
329
  ":".join(self.disney_data["duration"].split(":")[:3])
@@ -465,7 +466,7 @@ class EntityBase(DisneyAPIMixin, ThemeParkAPIMixin):
465
466
  if isinstance(entity_type, FacilityServiceEntityTypes):
466
467
  entity_type = entity_type.value
467
468
 
468
- children_url = f"{self.__facility_service_url}/{entity_type}"
469
+ children_url = f"{self._facility_service_url}/{entity_type}"
469
470
  data = self.get_disney_data(children_url)
470
471
  if data:
471
472
  return [
@@ -0,0 +1,226 @@
1
+ import typing
2
+
3
+ from mousetools.entities.base import EntityBase
4
+ from mousetools.ids import FacilityServiceEntityTypes
5
+
6
+
7
+ class MenuItem:
8
+ def __init__(self, raw_item_data: dict):
9
+ self._raw_item_data = raw_item_data
10
+
11
+ def __repr__(self) -> str:
12
+ return f"MenuItem(entity_id={self.entity_id}, name={self.name})"
13
+
14
+ @property
15
+ def entity_id(self) -> typing.Optional[str]:
16
+ """
17
+ The entity id of the menu item.
18
+
19
+ Returns:
20
+ (typing.Optional[str]): The entity id of the menu item.
21
+ """
22
+ try:
23
+ return self._raw_item_data["id"]
24
+ except KeyError:
25
+ return None
26
+
27
+ @property
28
+ def name(self) -> typing.Optional[str]:
29
+ """
30
+ The name of the menu item.
31
+
32
+ Returns:
33
+ (typing.Optional[str]): The name of the menu item.
34
+ """
35
+ try:
36
+ return self._raw_item_data["name"]
37
+ except KeyError:
38
+ return None
39
+
40
+ @property
41
+ def type_name(self) -> typing.Optional[str]:
42
+ """
43
+ The type of the menu item.
44
+
45
+ Returns:
46
+ (typing.Optional[str]): The type of the menu item.
47
+ """
48
+ try:
49
+ return self._raw_item_data["type"]
50
+ except KeyError:
51
+ return None
52
+
53
+ @property
54
+ def price(self) -> typing.Optional[dict]:
55
+ """
56
+ The price of the menu item.
57
+
58
+ Examples:
59
+ {'price_qualifier': 'Per Serving', 'price_without_tax': 6.29}
60
+
61
+ Returns:
62
+ (typing.Optional[dict]): The price of the menu item.
63
+ """
64
+ try:
65
+ for i in self._raw_item_data["prices"]:
66
+ if i["type"] == "Retail":
67
+ return {
68
+ "price_without_tax": float(
69
+ i["priceSpecifications"][0]["priceWithoutTax"]
70
+ ),
71
+ "price_qualifier": i["priceSpecifications"][0][
72
+ "priceQualifier"
73
+ ],
74
+ }
75
+ except KeyError:
76
+ return None
77
+
78
+ return None
79
+
80
+
81
+ class Menu:
82
+ def __init__(self, raw_menu_data: dict):
83
+ self._raw_menu_data = raw_menu_data
84
+
85
+ def __repr__(self) -> str:
86
+ return f"Menu(entity_id={self.entity_id}, name={self.name})"
87
+
88
+ @property
89
+ def entity_id(self) -> typing.Optional[str]:
90
+ """
91
+ The entity id of the menu.
92
+
93
+ Returns:
94
+ (typing.Optional[str]): The entity id of the menu.
95
+ """
96
+ try:
97
+ return self._raw_menu_data["id"]
98
+ except KeyError:
99
+ return None
100
+
101
+ @property
102
+ def name(self) -> typing.Optional[str]:
103
+ """
104
+ The name of the menu.
105
+
106
+ Returns:
107
+ (typing.Optional[str]): The name of the menu.
108
+ """
109
+ try:
110
+ return self._raw_menu_data["name"]
111
+ except KeyError:
112
+ return None
113
+
114
+ @property
115
+ def type_name(self) -> typing.Optional[str]:
116
+ """
117
+ The type of the menu.
118
+
119
+ Returns:
120
+ (typing.Optional[str]): The type of the menu.
121
+ """
122
+ try:
123
+ return self._raw_menu_data["type"]
124
+ except KeyError:
125
+ return None
126
+
127
+ @property
128
+ def menu_items(self) -> list[MenuItem]:
129
+ """
130
+ The menu items of the menu.
131
+
132
+ Returns:
133
+ (list[MenuItem]): The menu items of the menu.
134
+ """
135
+ try:
136
+ return [MenuItem(i) for i in self._raw_menu_data["menuItems"]]
137
+ except KeyError:
138
+ return []
139
+
140
+
141
+ class Menus(EntityBase):
142
+ """Class for Menu Entities."""
143
+
144
+ def __init__(self, entity_id: str):
145
+ super().__init__(
146
+ entity_id=entity_id,
147
+ facility_service_entity_type=FacilityServiceEntityTypes.MENU_ITEMS,
148
+ )
149
+
150
+ @property
151
+ def price_range(self) -> typing.Optional[str]:
152
+ """
153
+ The price range of the menu.
154
+
155
+ Examples:
156
+ "$ ($14.99 and under per adult)"
157
+
158
+ Returns:
159
+ (typing.Optional[str]): Price range of menu desribed in $.
160
+ """
161
+ if self.disney_data is None:
162
+ self.disney_data = self.get_disney_data(self._facility_service_url)
163
+ try:
164
+ return self.disney_data["priceRange"]
165
+ except KeyError:
166
+ return None
167
+
168
+ @property
169
+ def service_style(self) -> typing.Optional[str]:
170
+ """
171
+ The service style of the menu.
172
+
173
+ Returns:
174
+ (typing.Optional[str]): The service style of the menu.
175
+ """
176
+ if self.disney_data is None:
177
+ self.disney_data = self.get_disney_data(self._facility_service_url)
178
+ try:
179
+ return self.disney_data["serviceStyle"]
180
+ except KeyError:
181
+ return None
182
+
183
+ @property
184
+ def meal_period_type(self) -> typing.Optional[str]:
185
+ """
186
+ The meal period type of the menu.
187
+
188
+ Returns:
189
+ (typing.Optional[str]): The meal period type of the menu.
190
+ """
191
+ if self.disney_data is None:
192
+ self.disney_data = self.get_disney_data(self._facility_service_url)
193
+ try:
194
+ return self.disney_data["mealPeriodType"]
195
+ except KeyError:
196
+ return None
197
+
198
+ @property
199
+ def primary_cuisine_type(self) -> typing.Optional[str]:
200
+ """
201
+ The primary cuisine type of the menu.
202
+
203
+ Returns:
204
+ (typing.Optional[str]): The primary cuisine type of the menu.
205
+ """
206
+ if self.disney_data is None:
207
+ self.disney_data = self.get_disney_data(self._facility_service_url)
208
+ try:
209
+ return self.disney_data["primaryCuisineType"]
210
+ except KeyError:
211
+ return None
212
+
213
+ @property
214
+ def menus(self) -> list[Menu]:
215
+ """
216
+ Returns a list of all the menus associated with this entity.
217
+
218
+ Returns:
219
+ (list[Menu]): List of Menu objects that are associated with this entity.
220
+ """
221
+ if self.disney_data is None:
222
+ self.disney_data = self.get_disney_data(self._facility_service_url)
223
+ try:
224
+ return [Menu(i) for i in self.disney_data["menus"]]
225
+ except KeyError:
226
+ return []
@@ -0,0 +1,53 @@
1
+ import logging
2
+ import typing
3
+
4
+ from mousetools.entities.base import EntityBase
5
+ from mousetools.ids import FacilityServiceEntityTypes
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+
10
+ class Restaurant(EntityBase):
11
+ """Class for Restaurant Entities."""
12
+
13
+ def __init__(self, entity_id: str):
14
+ super().__init__(
15
+ entity_id=entity_id,
16
+ facility_service_entity_type=FacilityServiceEntityTypes.RESTAURANTS,
17
+ )
18
+
19
+ @property
20
+ def service_styles(self) -> typing.Optional[list[str]]:
21
+ """
22
+ The service styles offered by the restaurant.
23
+
24
+ Returns:
25
+ (typing.Optional[list[str]]): The service styles offered by the restaurant.
26
+ """
27
+ if self.disney_data is None:
28
+ self.disney_data = self.get_disney_data(self._facility_service_url)
29
+ try:
30
+ return self.disney_data["serviceStyles"]
31
+ except KeyError:
32
+ logger.debug("No service styles found for %s", self.entity_id)
33
+ return None
34
+
35
+ @property
36
+ def menu_id(self) -> typing.Optional[str]:
37
+ """
38
+ The menu id associated with the restaurant.
39
+
40
+ Returns:
41
+ (typing.Optional[str]): The menu id associated with the restaurant.
42
+ """
43
+ if self.disney_data is None:
44
+ self.disney_data = self.get_disney_data(self._facility_service_url)
45
+ try:
46
+ return (
47
+ self.disney_data["menuItems"][0]["links"]["self"]["href"]
48
+ .split("?")[0]
49
+ .split("/")[-1]
50
+ )
51
+ except KeyError:
52
+ logger.debug("No menu id found for %s", self.entity_id)
53
+ return None
@@ -30,8 +30,6 @@ class DisneyAPIMixin:
30
30
  logger.info("Sending request to %s", url)
31
31
  response = httpx.get(url, headers=auth_obj.get_headers())
32
32
  logger.debug("Response status: %s", response.status_code)
33
- if response.status_code == httpx._status_codes.codes.NOT_FOUND:
34
- raise EntityIDNotFoundError
35
33
 
36
34
  try:
37
35
  response.raise_for_status()
@@ -49,6 +47,8 @@ class DisneyAPIMixin:
49
47
  logger.debug("Sending new request to %s", url)
50
48
  response = httpx.get(url, headers=auth_obj.get_headers())
51
49
  logger.debug("Response status: %s", response.status_code)
50
+ if response.status_code == httpx._status_codes.codes.NOT_FOUND:
51
+ raise EntityIDNotFoundError
52
52
  response.raise_for_status()
53
53
  data = response.json()
54
54
 
@@ -1,7 +1,3 @@
1
- [build-system]
2
- requires = ["setuptools"]
3
- build-backend = "setuptools.build_meta"
4
-
5
1
  [project]
6
2
  name = "MouseTools"
7
3
  dynamic = ["version"]
@@ -21,6 +17,23 @@ classifiers = [
21
17
 
22
18
  [project.urls]
23
19
  repository = "https://gitlab.com/caratozzoloxyz/public/MouseTools"
20
+ documentation = "https://caratozzoloxyz.gitlab.io/public/MouseTools/"
21
+
22
+ [tool.uv]
23
+ dev-dependencies = [
24
+ "mkdocs>=1.6.1",
25
+ "mkdocs-material>=9.5.33",
26
+ "mkdocstrings[python]>=0.25.2",
27
+ "mypy>=1.11.2",
28
+ "pre-commit>=3.5.0",
29
+ "pytest-cov>=5.0.0",
30
+ "pytest>=8.3.2",
31
+ "ruff>=0.6.3",
32
+ ]
33
+
34
+ [build-system]
35
+ requires = ["setuptools"]
36
+ build-backend = "setuptools.build_meta"
24
37
 
25
38
  [tool.setuptools.dynamic]
26
39
  version = {attr = "mousetools.__version__"}
@@ -67,49 +80,64 @@ minor_tags = ["feat"]
67
80
  patch_tags = ["fix", "perf"]
68
81
  default_bump_level = 0
69
82
 
70
- [tool.semantic_release.remote]
71
- name = "origin"
72
- type = "gitlab"
73
- ignore_token_for_push = true
74
- insecure = false
75
- token = { env = "GITLAB_TOKEN" }
76
-
77
83
  [tool.semantic_release.publish]
78
- dist_glob_patterns = ["dist/*"]
79
84
  upload_to_vcs_release = false
80
85
 
86
+ [tool.pytest.ini_options]
87
+ testpaths = ["tests"]
88
+
81
89
 
82
90
  [tool.ruff]
83
91
  target-version = "py39"
92
+ line-length = 120
84
93
 
85
94
  [tool.ruff.lint]
86
95
  select = [
87
- "F",
88
- "E",
89
- "W",
90
- "I",
91
- "N",
96
+ # flake8-2020
97
+ "YTT",
98
+ # flake8-bandit
99
+ "S",
100
+ # flake8-bugbear
101
+ "B",
102
+ # flake8-builtins
92
103
  "A",
104
+ # flake8-comprehensions
93
105
  "C4",
94
- "DTZ002", "DTZ003",
95
- "G010",
96
- "T20",
97
- "ERA",
98
- "PL",
106
+ # flake8-debugger
107
+ "T10",
108
+ # flake8-simplify
109
+ "SIM",
110
+ # isort
111
+ "I",
112
+ # mccabe
113
+ "C90",
114
+ # pycodestyle
115
+ "E", "W",
116
+ # pyflakes
117
+ "F",
118
+ # pyupgrade
119
+ "UP",
120
+ # ruff
121
+ "RUF",
99
122
  ]
100
-
101
123
  ignore = [
124
+ # LineTooLong
102
125
  "E501",
126
+ # DoNotAssignLambda
127
+ "E731",
103
128
  ]
104
129
 
105
- [tool.uv]
106
- dev-dependencies = [
107
- "mkdocs>=1.6.1",
108
- "mkdocs-material>=9.5.33",
109
- "mkdocstrings[python]>=0.25.2",
110
- "mypy>=1.11.2",
111
- "pre-commit>=3.5.0",
112
- "pytest-cov>=5.0.0",
113
- "pytest>=8.3.2",
114
- "ruff>=0.6.3",
115
- ]
130
+ [tool.ruff.lint.per-file-ignores]
131
+ # Use of `assert` detected
132
+ "**/tests/*" = ["S101"]
133
+
134
+
135
+ [tool.mypy]
136
+ python_version = "3.9"
137
+ files = ["mousetools"]
138
+ disallow_untyped_defs = "True"
139
+ disallow_any_unimported = "True"
140
+ no_implicit_optional = "True"
141
+ check_untyped_defs = "True"
142
+ warn_unused_ignores = "True"
143
+ show_error_codes = "True"
@@ -13,6 +13,7 @@ from mousetools.entities.entertainment_venue import EntertainmentVenue
13
13
  from mousetools.entities.event import Event
14
14
  from mousetools.entities.guest_services import GuestServices
15
15
  from mousetools.entities.land import Land
16
+ from mousetools.entities.menu import Menus
16
17
  from mousetools.entities.merchandise_facility import MerchandiseFacility
17
18
  from mousetools.entities.park import ThemePark, WaterPark
18
19
  from mousetools.entities.point_of_interest import PointOfInterest
@@ -57,6 +58,7 @@ POINT_OF_INTEREST_PARAMS = [
57
58
  RESORT_PARAMS = [pytest.param(Resort("80010390"), id="Resort")]
58
59
  RESORT_AREA_PARAMS = [pytest.param(ResortArea("80069772"), id="ResortArea")]
59
60
  RESTAURANT_PARAMS = [pytest.param(Restaurant("19233597"), id="Restaurant")]
61
+ MENU_PARAMS = [pytest.param(Menus("19256571"), id="Menus")]
60
62
 
61
63
  TEST_ALL_ENTITIES = pytest.mark.parametrize(
62
64
  "entity_obj",
@@ -76,7 +78,8 @@ TEST_ALL_ENTITIES = pytest.mark.parametrize(
76
78
  + POINT_OF_INTEREST_PARAMS
77
79
  + RESORT_PARAMS
78
80
  + RESORT_AREA_PARAMS
79
- + RESTAURANT_PARAMS,
81
+ + RESTAURANT_PARAMS
82
+ + MENU_PARAMS,
80
83
  )
81
84
 
82
85
 
@@ -1,12 +0,0 @@
1
- from mousetools.entities.base import EntityBase
2
- from mousetools.ids import FacilityServiceEntityTypes
3
-
4
-
5
- class Menu(EntityBase):
6
- """Class for Menu Entities."""
7
-
8
- def __init__(self, entity_id: str):
9
- super().__init__(
10
- entity_id=entity_id,
11
- facility_service_entity_type=FacilityServiceEntityTypes.MENU_ITEMS,
12
- )
@@ -1,12 +0,0 @@
1
- from mousetools.entities.base import EntityBase
2
- from mousetools.ids import FacilityServiceEntityTypes
3
-
4
-
5
- class Restaurant(EntityBase):
6
- """Class for Restaurant Entities."""
7
-
8
- def __init__(self, entity_id: str):
9
- super().__init__(
10
- entity_id=entity_id,
11
- facility_service_entity_type=FacilityServiceEntityTypes.RESTAURANTS,
12
- )
File without changes