MouseTools 3.0.0.dev1__py3-none-any.whl → 3.0.0.dev2__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.
- {MouseTools-3.0.0.dev1.dist-info → MouseTools-3.0.0.dev2.dist-info}/METADATA +41 -3
- MouseTools-3.0.0.dev2.dist-info/RECORD +32 -0
- {MouseTools-3.0.0.dev1.dist-info → MouseTools-3.0.0.dev2.dist-info}/WHEEL +1 -1
- mousetools/__init__.py +1 -7
- mousetools/auth.py +13 -3
- mousetools/entities/__init__.py +34 -6
- mousetools/entities/attraction.py +8 -4
- mousetools/entities/base.py +235 -129
- mousetools/entities/character.py +12 -0
- mousetools/entities/destination.py +12 -4
- mousetools/entities/dining_event.py +8 -11
- mousetools/entities/dinner_show.py +12 -0
- mousetools/entities/entertainment.py +8 -4
- mousetools/entities/entertainment_venue.py +8 -4
- mousetools/entities/event.py +8 -4
- mousetools/entities/guest_services.py +12 -0
- mousetools/entities/land.py +12 -0
- mousetools/entities/menu.py +12 -0
- mousetools/entities/merchandise_facility.py +8 -4
- mousetools/entities/park.py +39 -5
- mousetools/entities/point_of_interest.py +12 -0
- mousetools/entities/resort.py +8 -4
- mousetools/entities/resort_area.py +12 -0
- mousetools/entities/restaurant.py +8 -4
- mousetools/exceptions.py +3 -3
- mousetools/ids.py +42 -36
- mousetools/mixins/disney.py +37 -46
- mousetools/mixins/themeparksapi.py +20 -14
- mousetools/urls.py +2 -3
- MouseTools-3.0.0.dev1.dist-info/RECORD +0 -25
- {MouseTools-3.0.0.dev1.dist-info → MouseTools-3.0.0.dev2.dist-info}/LICENSE +0 -0
- {MouseTools-3.0.0.dev1.dist-info → MouseTools-3.0.0.dev2.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
from mousetools.entities.base import
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
class Entertainment(
|
|
5
|
+
class Entertainment(EntityBase):
|
|
5
6
|
"""Class for Entertainment Entities."""
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
-
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.ENTERTAINMENTS,
|
|
12
|
+
)
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
from mousetools.entities.base import
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
class EntertainmentVenue(
|
|
5
|
+
class EntertainmentVenue(EntityBase):
|
|
5
6
|
"""Class for EntertainmentVenue Entities."""
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
-
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.ENTERTAINMENT_VENUES,
|
|
12
|
+
)
|
mousetools/entities/event.py
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
from mousetools.entities.base import
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
class Event(
|
|
5
|
+
class Event(EntityBase):
|
|
5
6
|
"""Class for Event Entities."""
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
-
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.EVENTS,
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class GuestServices(EntityBase):
|
|
6
|
+
"""Class for Guest Services Entities."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.GUEST_SERVICES,
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Land(EntityBase):
|
|
6
|
+
"""Class for Land Entities."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.LANDS,
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
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,8 +1,12 @@
|
|
|
1
|
-
from mousetools.entities.base import
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
class MerchandiseFacility(
|
|
5
|
+
class MerchandiseFacility(EntityBase):
|
|
5
6
|
"""Class for MerchandiseFacility Entities."""
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
-
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.MERCHANDISE_FACILITIES,
|
|
12
|
+
)
|
mousetools/entities/park.py
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
import typing
|
|
2
2
|
|
|
3
|
+
from mousetools.entities.base import EntityBase
|
|
4
|
+
from mousetools.ids import (
|
|
5
|
+
DisneylandResortParkIds,
|
|
6
|
+
FacilityServiceEntityTypes,
|
|
7
|
+
WaltDisneyWorldParkIds,
|
|
8
|
+
)
|
|
3
9
|
|
|
4
|
-
class Park(Entity):
|
|
5
|
-
"""Class for Park Entities."""
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
class ThemePark(EntityBase):
|
|
12
|
+
"""Class for Theme Park Entities."""
|
|
13
|
+
|
|
14
|
+
def __init__(
|
|
15
|
+
self,
|
|
16
|
+
entity_id: typing.Union[str, WaltDisneyWorldParkIds, DisneylandResortParkIds],
|
|
17
|
+
):
|
|
18
|
+
if isinstance(entity_id, WaltDisneyWorldParkIds) or isinstance(
|
|
19
|
+
entity_id, DisneylandResortParkIds
|
|
20
|
+
):
|
|
21
|
+
entity_id = entity_id.value
|
|
22
|
+
super().__init__(
|
|
23
|
+
entity_id=entity_id,
|
|
24
|
+
facility_service_entity_type=FacilityServiceEntityTypes.THEME_PARKS,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class WaterPark(EntityBase):
|
|
29
|
+
"""Class for Water Park Entities."""
|
|
30
|
+
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
entity_id: typing.Union[str, WaltDisneyWorldParkIds, DisneylandResortParkIds],
|
|
34
|
+
):
|
|
35
|
+
if isinstance(entity_id, WaltDisneyWorldParkIds) or isinstance(
|
|
36
|
+
entity_id, DisneylandResortParkIds
|
|
37
|
+
):
|
|
38
|
+
entity_id = entity_id.value
|
|
39
|
+
super().__init__(
|
|
40
|
+
entity_id=entity_id,
|
|
41
|
+
facility_service_entity_type=FacilityServiceEntityTypes.WATER_PARKS,
|
|
42
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class PointOfInterest(EntityBase):
|
|
6
|
+
"""Class for point of interest Entities."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.POINTS_OF_INTEREST,
|
|
12
|
+
)
|
mousetools/entities/resort.py
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
from mousetools.entities.base import
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
class Resort(
|
|
5
|
+
class Resort(EntityBase):
|
|
5
6
|
"""Class for Resort Entities."""
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
-
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.RESORTS,
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ResortArea(EntityBase):
|
|
6
|
+
"""Class for Resort Area Entities."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.RESORT_AREAS,
|
|
12
|
+
)
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
from mousetools.entities.base import
|
|
1
|
+
from mousetools.entities.base import EntityBase
|
|
2
|
+
from mousetools.ids import FacilityServiceEntityTypes
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
class Restaurant(
|
|
5
|
+
class Restaurant(EntityBase):
|
|
5
6
|
"""Class for Restaurant Entities."""
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
-
|
|
8
|
+
def __init__(self, entity_id: str):
|
|
9
|
+
super().__init__(
|
|
10
|
+
entity_id=entity_id,
|
|
11
|
+
facility_service_entity_type=FacilityServiceEntityTypes.RESTAURANTS,
|
|
12
|
+
)
|
mousetools/exceptions.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
class
|
|
1
|
+
class MouseToolsError(Exception):
|
|
2
2
|
"""Base class for all MouseTools exceptions."""
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class EntityIDNotFoundError(MouseToolsError):
|
|
6
6
|
"""Raised when an enity id could not be found."""
|
|
7
7
|
|
|
8
8
|
# TODO add id to message
|
|
@@ -10,7 +10,7 @@ class EntityIDNotFound(MouseToolsException):
|
|
|
10
10
|
super().__init__(message)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class
|
|
13
|
+
class AncestorDestinationMissingError(MouseToolsError):
|
|
14
14
|
"""Raised for entities missing ancestor destination."""
|
|
15
15
|
|
|
16
16
|
def __init__(self, message="Entity missing ancestor destination id."):
|
mousetools/ids.py
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
from dataclasses import dataclass
|
|
3
|
-
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
4
|
-
from mousetools.auth import auth_obj
|
|
5
|
-
from mousetools.urls import ANCESTOR_ENTITIES_BASE_URL
|
|
6
|
-
import requests
|
|
7
1
|
import logging
|
|
2
|
+
from enum import Enum
|
|
8
3
|
|
|
9
4
|
logger = logging.getLogger(__name__)
|
|
10
5
|
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
class DestinationIds:
|
|
7
|
+
class DestinationIds(str, Enum):
|
|
14
8
|
WALT_DISNEY_WORLD: str = "80007798;entityType=destination"
|
|
15
9
|
"""The destination id for Walt Disney World."""
|
|
16
10
|
DISNEYLAND_RESORT: str = "80008297;entityType=destination"
|
|
17
11
|
"""The destination id for Disneyland Resort."""
|
|
18
12
|
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
class WaltDisneyWorldParkIds:
|
|
14
|
+
class WaltDisneyWorldParkIds(str, Enum):
|
|
22
15
|
MAGIC_KINGDOM: str = "80007944;entityType=theme-park"
|
|
23
16
|
"""The Park id for Magic Kingdom."""
|
|
24
17
|
EPCOT: str = "80007838;entityType=theme-park"
|
|
@@ -33,16 +26,14 @@ class WaltDisneyWorldParkIds:
|
|
|
33
26
|
"""The Park id for Blizzard Beach."""
|
|
34
27
|
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
class DisneylandResortParkIds:
|
|
29
|
+
class DisneylandResortParkIds(str, Enum):
|
|
38
30
|
DISNEYLAND: str = "330339;entityType=theme-park"
|
|
39
31
|
"""The Park id for Disneyland."""
|
|
40
32
|
CALIFORNIA_ADVENTURE: str = "336894;entityType=theme-park"
|
|
41
33
|
"""The Park id for California Adventure."""
|
|
42
34
|
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
class ThemeParkAPIIds:
|
|
36
|
+
class ThemeParkAPIIds(str, Enum):
|
|
46
37
|
WALT_DISNEY_WORLD: str = "e957da41-3552-4cf6-b636-5babc5cbc4e5"
|
|
47
38
|
"""The ThemeParks.Wiki id for Walt Disney World."""
|
|
48
39
|
MAGIC_KINGDOM: str = "75ea578a-adc8-4116-a54d-dccb60765ef9"
|
|
@@ -66,25 +57,40 @@ class ThemeParkAPIIds:
|
|
|
66
57
|
"""The ThemeParks.Wiki id for California Adventure."""
|
|
67
58
|
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
60
|
+
class FacilityServiceEntityTypes(str, Enum):
|
|
61
|
+
DESTINATIONS: str = "destinations"
|
|
62
|
+
"""Facility service url path for destinations."""
|
|
63
|
+
THEME_PARKS: str = "theme-parks"
|
|
64
|
+
"""Facility service url path for theme parks."""
|
|
65
|
+
WATER_PARKS: str = "water-parks"
|
|
66
|
+
"""Facility service url path for water parks."""
|
|
67
|
+
CHARACTERS: str = "characters"
|
|
68
|
+
"""Facility service url path for characters."""
|
|
69
|
+
DINING_EVENTS: str = "dining-events"
|
|
70
|
+
"""Facility service url path for dining events."""
|
|
71
|
+
DINNER_SHOWS: str = "dinner-shows"
|
|
72
|
+
"""Facility service url path for dinner shows."""
|
|
73
|
+
RESTAURANTS: str = "restaurants"
|
|
74
|
+
"""Facility service url path for restaurants."""
|
|
75
|
+
ENTERTAINMENTS: str = "entertainments"
|
|
76
|
+
"""Facility service url path for entertainments."""
|
|
77
|
+
ENTERTAINMENT_VENUES: str = "entertainment-venues"
|
|
78
|
+
"""Facility service url path for entertainment venues."""
|
|
79
|
+
EVENTS: str = "events"
|
|
80
|
+
"""Facility service url path for events."""
|
|
81
|
+
GUEST_SERVICES: str = "guest-services"
|
|
82
|
+
"""Facility service url path for guest services."""
|
|
83
|
+
RESORTS: str = "resorts"
|
|
84
|
+
"""Facility service url path for resorts."""
|
|
85
|
+
RESORT_AREAS: str = "resort-areas"
|
|
86
|
+
"""Facility service url path for resort areas."""
|
|
87
|
+
ATTRACTIONS: str = "attractions"
|
|
88
|
+
"""Facility service url path for attractions."""
|
|
89
|
+
POINTS_OF_INTEREST: str = "points-of-interest"
|
|
90
|
+
"""Facility service url path for points of interest."""
|
|
91
|
+
LANDS: str = "lands"
|
|
92
|
+
"""Facility service url path for lands."""
|
|
93
|
+
MERCHANDISE_FACILITIES: str = "shops"
|
|
94
|
+
"""Facility service url path for merchandise facilities."""
|
|
95
|
+
MENU_ITEMS: str = "menu-items"
|
|
96
|
+
"""Facility service url path for menu items."""
|
mousetools/mixins/disney.py
CHANGED
|
@@ -1,64 +1,55 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
3
5
|
from mousetools.auth import auth_obj
|
|
4
|
-
from mousetools import
|
|
5
|
-
from mousetools.
|
|
6
|
-
|
|
6
|
+
from mousetools.exceptions import EntityIDNotFoundError
|
|
7
|
+
from mousetools.urls import (
|
|
8
|
+
WDPRAPPS_FACILITY_SERVICE_BASE_URL,
|
|
9
|
+
WDPRO_FACILITY_SERVICE_BASE_URL,
|
|
10
|
+
)
|
|
7
11
|
|
|
8
12
|
logger = logging.getLogger(__name__)
|
|
9
13
|
|
|
10
14
|
|
|
11
15
|
class DisneyAPIMixin:
|
|
12
|
-
|
|
13
|
-
# should be set in subclass
|
|
14
|
-
id = ""
|
|
15
|
-
|
|
16
|
-
def get_disney_data(self):
|
|
17
|
-
"""
|
|
18
|
-
Finds the entity in the Disney data and stores it in the
|
|
19
|
-
disney_data attribute. Also stores the ancestor destination id in
|
|
20
|
-
the _ancenstor_destination_id attribute.
|
|
21
|
-
|
|
22
|
-
Returns:
|
|
23
|
-
(dict): The disney data.
|
|
24
|
-
|
|
25
|
-
Raises:
|
|
26
|
-
(EntityIDNotFound): If the entity is not found in the Disney data.
|
|
16
|
+
def get_disney_data(self, url: str):
|
|
27
17
|
"""
|
|
28
|
-
|
|
29
|
-
if self.id == i["id"]:
|
|
30
|
-
self._ancestor_destination_id = DestinationIds.WALT_DISNEY_WORLD
|
|
31
|
-
logger.info("Entity %s found in Walt Disney World", self.id)
|
|
32
|
-
return i
|
|
18
|
+
Sends a request to the Disney API at the given url and returns the data.
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
self._ancestor_destination_id = DestinationIds.DISNEYLAND_RESORT
|
|
37
|
-
logger.info("Entity %s found in Disneyland Resort", self.id)
|
|
38
|
-
return i
|
|
39
|
-
|
|
40
|
-
raise EntityIDNotFound
|
|
41
|
-
|
|
42
|
-
def get_extended_disney_data(self):
|
|
43
|
-
"""
|
|
44
|
-
Gets the extended disney data for this entity from the Disney API.
|
|
45
|
-
|
|
46
|
-
The extended data is the data returned by the simple details API endpoint.
|
|
20
|
+
Args:
|
|
21
|
+
url (str): API url to request data from.
|
|
47
22
|
|
|
48
23
|
Returns:
|
|
49
|
-
(dict): The
|
|
24
|
+
(dict): The disney data.
|
|
50
25
|
|
|
51
26
|
Raises:
|
|
52
|
-
(
|
|
27
|
+
(EntityIDNotFoundError): If the entity is not found.
|
|
28
|
+
(httpx.HTTPError): All other errors during http request.
|
|
53
29
|
"""
|
|
54
|
-
|
|
55
|
-
|
|
30
|
+
logger.info("Sending request to %s", url)
|
|
31
|
+
response = httpx.get(url, headers=auth_obj.get_headers())
|
|
32
|
+
logger.debug("Response status: %s", response.status_code)
|
|
33
|
+
if response.status_code == httpx._status_codes.codes.NOT_FOUND:
|
|
34
|
+
raise EntityIDNotFoundError
|
|
56
35
|
|
|
57
36
|
try:
|
|
58
|
-
response = requests.get(self.details_simple_url(), headers=headers)
|
|
59
|
-
|
|
60
37
|
response.raise_for_status()
|
|
61
|
-
|
|
38
|
+
data = response.json()
|
|
39
|
+
except httpx.HTTPError:
|
|
40
|
+
logger.warning("Request failed. Retrying with updated url...")
|
|
41
|
+
if WDPRO_FACILITY_SERVICE_BASE_URL in url:
|
|
42
|
+
url = url.replace(
|
|
43
|
+
WDPRO_FACILITY_SERVICE_BASE_URL, WDPRAPPS_FACILITY_SERVICE_BASE_URL
|
|
44
|
+
)
|
|
45
|
+
else:
|
|
46
|
+
url = url.replace(
|
|
47
|
+
WDPRAPPS_FACILITY_SERVICE_BASE_URL, WDPRO_FACILITY_SERVICE_BASE_URL
|
|
48
|
+
)
|
|
49
|
+
logger.debug("Sending new request to %s", url)
|
|
50
|
+
response = httpx.get(url, headers=auth_obj.get_headers())
|
|
51
|
+
logger.debug("Response status: %s", response.status_code)
|
|
52
|
+
response.raise_for_status()
|
|
53
|
+
data = response.json()
|
|
62
54
|
|
|
63
|
-
|
|
64
|
-
logger.debug("Error getting extended disney data: %s", e)
|
|
55
|
+
return data
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import typing
|
|
2
1
|
import logging
|
|
3
|
-
import
|
|
2
|
+
import typing
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from mousetools.exceptions import AncestorDestinationMissingError, EntityIDNotFoundError
|
|
4
7
|
from mousetools.ids import DestinationIds, ThemeParkAPIIds
|
|
5
8
|
from mousetools.urls import THEMEPARK_BASE_URL
|
|
6
|
-
from mousetools.exceptions import AncestorDestinationMissing, EntityIDNotFound
|
|
7
9
|
|
|
8
10
|
logger = logging.getLogger(__name__)
|
|
9
11
|
|
|
@@ -11,7 +13,7 @@ logger = logging.getLogger(__name__)
|
|
|
11
13
|
class ThemeParkAPIMixin:
|
|
12
14
|
_tp_entity_id = None
|
|
13
15
|
# Should be set in subclass
|
|
14
|
-
|
|
16
|
+
entity_id = ""
|
|
15
17
|
ancestor_destination_id: typing.Optional[str] = None
|
|
16
18
|
|
|
17
19
|
@staticmethod
|
|
@@ -26,10 +28,11 @@ class ThemeParkAPIMixin:
|
|
|
26
28
|
(dict): The response, parsed as JSON
|
|
27
29
|
|
|
28
30
|
Raises:
|
|
29
|
-
(
|
|
31
|
+
(httpx.HTTPError): If the request fails
|
|
30
32
|
"""
|
|
31
33
|
logger.debug("Sending request to %s", url)
|
|
32
|
-
response =
|
|
34
|
+
response = httpx.get(url)
|
|
35
|
+
logger.debug("Response status: %s", response.status_code)
|
|
33
36
|
response.raise_for_status()
|
|
34
37
|
return response.json()
|
|
35
38
|
|
|
@@ -42,30 +45,33 @@ class ThemeParkAPIMixin:
|
|
|
42
45
|
(str): The id of this entity on the ThemeParks.Wiki API
|
|
43
46
|
|
|
44
47
|
Raises:
|
|
45
|
-
(
|
|
48
|
+
(AncestorDestinationMissingError): If the ancestor destination id is not
|
|
46
49
|
either Walt Disney World or Disneyland Resort
|
|
47
|
-
(
|
|
50
|
+
(EntityIDNotFoundError): If no ThemeParks.Wiki API id is found for this entity
|
|
48
51
|
"""
|
|
49
52
|
|
|
50
53
|
if self._tp_entity_id is not None:
|
|
51
54
|
return self._tp_entity_id
|
|
52
55
|
|
|
53
|
-
if self.ancestor_destination_id
|
|
56
|
+
if self.ancestor_destination_id is None:
|
|
57
|
+
raise AncestorDestinationMissingError
|
|
58
|
+
|
|
59
|
+
if self.ancestor_destination_id in DestinationIds.WALT_DISNEY_WORLD.value:
|
|
54
60
|
tp_destination_id = ThemeParkAPIIds.WALT_DISNEY_WORLD
|
|
55
|
-
elif self.ancestor_destination_id
|
|
61
|
+
elif self.ancestor_destination_id in DestinationIds.DISNEYLAND_RESORT.value:
|
|
56
62
|
tp_destination_id = ThemeParkAPIIds.DISNEYLAND_RESORT
|
|
57
63
|
else:
|
|
58
|
-
raise
|
|
64
|
+
raise AncestorDestinationMissingError
|
|
59
65
|
|
|
60
66
|
request_url = f"{THEMEPARK_BASE_URL}/entity/{tp_destination_id}/children"
|
|
61
67
|
children = self._send_tp_request(request_url)["children"]
|
|
62
68
|
|
|
63
69
|
for i in children:
|
|
64
|
-
if i["externalId"]
|
|
70
|
+
if self.entity_id in i["externalId"]:
|
|
65
71
|
self._tp_entity_id = i["id"]
|
|
66
72
|
return i["id"]
|
|
67
73
|
|
|
68
|
-
raise
|
|
74
|
+
raise EntityIDNotFoundError
|
|
69
75
|
|
|
70
76
|
def get_entity_tp(self) -> dict:
|
|
71
77
|
"""
|
|
@@ -117,6 +123,6 @@ class ThemeParkAPIMixin:
|
|
|
117
123
|
request_url = f"{request_url}/{year}/{month}"
|
|
118
124
|
else:
|
|
119
125
|
raise UserWarning(
|
|
120
|
-
"Missing year or month. Both must be passed to be used in request."
|
|
126
|
+
"Missing year or month. Both must be passed to be used in request.",
|
|
121
127
|
)
|
|
122
128
|
return self._send_tp_request(request_url)
|
mousetools/urls.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
ENTITY_DETAILS_SIMPLE_BASE_URL = "https://disneyworld.disney.go.com/finder/api/v1/explorer-service/details-entity-simple"
|
|
1
|
+
WDPRO_FACILITY_SERVICE_BASE_URL = "https://api.wdpro.disney.go.com/facility-service"
|
|
2
|
+
WDPRAPPS_FACILITY_SERVICE_BASE_URL = "https://api.wdprapps.disney.com/facility-service"
|
|
4
3
|
|
|
5
4
|
THEMEPARK_BASE_URL: str = "https://api.themeparks.wiki/v1"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
mousetools/__init__.py,sha256=83vn73ueEi1KaPISFpdHB5AmMwieJJmVEpV4ko9SZBE,581
|
|
2
|
-
mousetools/auth.py,sha256=XBCeD_hQaFPcSgKWWxYXpxwx2QxUk72adU4H8O5G-YY,2177
|
|
3
|
-
mousetools/exceptions.py,sha256=F94ohI_xDi0dLtTFInGhJL4u9TLY259OLmiiV6gcE_Q,538
|
|
4
|
-
mousetools/ids.py,sha256=k7pl9zeWSNUobr6RAJlQpEiwtH37RS4r6jZwvn0D0wI,3743
|
|
5
|
-
mousetools/urls.py,sha256=9GX9WYqfbg6Mv70Sz7WkqifFKUCvdYM3R7yZuQddvp4,302
|
|
6
|
-
mousetools/entities/__init__.py,sha256=g_USz0PsavrhDpUAuSz9eMBvxS1upJRgFoz9xLQl1kQ,742
|
|
7
|
-
mousetools/entities/attraction.py,sha256=R3Ju7hzdIu4kxzoSQRrSprOWoREu89AUN0Wc26R7iEQ,190
|
|
8
|
-
mousetools/entities/base.py,sha256=IVAAwszx-MgmwP5TIo-7aN_i2AysRXONS5UTDFOx-1g,13223
|
|
9
|
-
mousetools/entities/destination.py,sha256=_UUATQz_sdlWEYg1aAZeespPNkS7thzURbzZb5dvFWE,193
|
|
10
|
-
mousetools/entities/dining_event.py,sha256=OCHKiqmdzoraYxKxZs1EtfZRkqKCJdtMZNY3GOlbN-E,340
|
|
11
|
-
mousetools/entities/entertainment.py,sha256=CmgiJMShsph0gFbvMQzrmD5PaRp5mxeO9lUBY59cQBU,199
|
|
12
|
-
mousetools/entities/entertainment_venue.py,sha256=8xeYnjgrgK2kiXHDx_Qw-Q_u9DdKZFGuuXmS5cQ0-0g,214
|
|
13
|
-
mousetools/entities/event.py,sha256=R-6osBRaCj5AYLbmSOcd5JLcQBN_X-suP3bbEcTCWI0,175
|
|
14
|
-
mousetools/entities/merchandise_facility.py,sha256=YRcAJlcmKf7s-Khy2V42a4v1n4q_LXRE1h5JhSe3fqA,217
|
|
15
|
-
mousetools/entities/park.py,sha256=Tr_0HGwePXCV8rMiBrjyqdbCun40pDWSnf3mhLEyx9w,172
|
|
16
|
-
mousetools/entities/resort.py,sha256=6NS1UIxzL_t7reoPQ5Da-T070MuJ4tp9pIxiREECX6s,178
|
|
17
|
-
mousetools/entities/restaurant.py,sha256=TWbgp5e-Sw_EV9WrzyEebqbBeVtU7Jp_hb36i7hD-aE,190
|
|
18
|
-
mousetools/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
mousetools/mixins/disney.py,sha256=PnEpaR1s-yMV2YLJO_pF440p_qOBWu1V9fF5UEMECLY,2045
|
|
20
|
-
mousetools/mixins/themeparksapi.py,sha256=6Zeo0QDnfT4ovHrlycA-SDQiES6vXOivLWFUAn8AG0g,4123
|
|
21
|
-
MouseTools-3.0.0.dev1.dist-info/LICENSE,sha256=xX4HoDU-zdafl3yEfIaspkvqHPaaXhuDwkJ6qhDMUIo,1074
|
|
22
|
-
MouseTools-3.0.0.dev1.dist-info/METADATA,sha256=VUCidYBzR9DG3tyRq7pXjjJKGx9Q9B1hbAPvrSOQtWs,1570
|
|
23
|
-
MouseTools-3.0.0.dev1.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
|
24
|
-
MouseTools-3.0.0.dev1.dist-info/top_level.txt,sha256=7nanLN103J_xJn6HK6yuyqqlDgltCsQY2-ArRXx1Ukk,11
|
|
25
|
-
MouseTools-3.0.0.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|