MouseTools 2.1.2.dev2__py3-none-any.whl → 3.0.0.dev1__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-2.1.2.dev2.dist-info → MouseTools-3.0.0.dev1.dist-info}/LICENSE +1 -1
- MouseTools-3.0.0.dev1.dist-info/METADATA +39 -0
- MouseTools-3.0.0.dev1.dist-info/RECORD +25 -0
- {MouseTools-2.1.2.dev2.dist-info → MouseTools-3.0.0.dev1.dist-info}/WHEEL +1 -1
- mousetools/__init__.py +10 -24
- mousetools/auth.py +60 -42
- mousetools/entities/__init__.py +13 -0
- mousetools/entities/attraction.py +8 -0
- mousetools/entities/base.py +381 -0
- mousetools/entities/destination.py +8 -0
- mousetools/entities/dining_event.py +15 -0
- mousetools/entities/entertainment.py +8 -0
- mousetools/entities/entertainment_venue.py +8 -0
- mousetools/entities/event.py +8 -0
- mousetools/entities/merchandise_facility.py +8 -0
- mousetools/entities/park.py +8 -0
- mousetools/entities/resort.py +8 -0
- mousetools/entities/restaurant.py +8 -0
- mousetools/exceptions.py +17 -0
- mousetools/ids.py +90 -44
- mousetools/mixins/__init__.py +0 -0
- mousetools/mixins/disney.py +64 -0
- mousetools/mixins/themeparksapi.py +122 -0
- mousetools/urls.py +5 -0
- MouseTools-2.1.2.dev2.dist-info/METADATA +0 -101
- MouseTools-2.1.2.dev2.dist-info/RECORD +0 -16
- mousetools/attractions.py +0 -370
- mousetools/characters.py +0 -241
- mousetools/destinations.py +0 -400
- mousetools/entertainments.py +0 -470
- mousetools/entertainmentvenues.py +0 -264
- mousetools/facilities.py +0 -248
- mousetools/parks.py +0 -446
- mousetools/pointsofinterest.py +0 -186
- {MouseTools-2.1.2.dev2.dist-info → MouseTools-3.0.0.dev1.dist-info}/top_level.txt +0 -0
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import json
|
|
3
|
-
import pytz
|
|
4
|
-
from datetime import datetime, timedelta
|
|
5
|
-
from .auth import get_headers
|
|
6
|
-
from .ids import WDW_ID, DLR_ID
|
|
7
|
-
|
|
8
|
-
class EntertainmentVenue(object):
|
|
9
|
-
|
|
10
|
-
def __init__(self, id = None):
|
|
11
|
-
"""
|
|
12
|
-
Constructor Function
|
|
13
|
-
Gets all venue data available and stores various elements into variables.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
error = True
|
|
17
|
-
self.__data = requests.get("https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/entertainment-venues/{}".format(id), headers=get_headers()).json()
|
|
18
|
-
try:
|
|
19
|
-
if self.__data['id'] is not None:
|
|
20
|
-
error = False
|
|
21
|
-
except:
|
|
22
|
-
pass
|
|
23
|
-
|
|
24
|
-
if error:
|
|
25
|
-
raise ValueError('That entertainment venue is not available. id: ' + str(id))
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
self.__id = id
|
|
29
|
-
self.__name = self.__data['name']
|
|
30
|
-
self.__entityType = self.__data['type']
|
|
31
|
-
try:
|
|
32
|
-
self.__subType = self.__data['subType']
|
|
33
|
-
except:
|
|
34
|
-
self.__subType = None
|
|
35
|
-
try:
|
|
36
|
-
self.__anc_dest_id = self.__data['ancestorDestination']['id'].split(';')[0]
|
|
37
|
-
except:
|
|
38
|
-
self.__anc_dest_id = None
|
|
39
|
-
|
|
40
|
-
try:
|
|
41
|
-
self.__anc_park_id = self.__data['links']['ancestorThemePark']['href'].split('/')[-1].split('?')[0]
|
|
42
|
-
except:
|
|
43
|
-
try:
|
|
44
|
-
self.__anc_park_id = self.__data['links']['ancestorWaterPark']['href'].split('/')[-1].split('?')[0]
|
|
45
|
-
except:
|
|
46
|
-
try:
|
|
47
|
-
self.__anc_park_id = self.__data['ancestorThemeParkId'].split(';')[0]
|
|
48
|
-
except:
|
|
49
|
-
try:
|
|
50
|
-
self.__anc_park_id = self.__data['ancestorWaterParkId'].split(';')[0]
|
|
51
|
-
except:
|
|
52
|
-
self.__anc_park_id = None
|
|
53
|
-
|
|
54
|
-
try:
|
|
55
|
-
self.__anc_resort_id = self.__data['links']['ancestorResort']['href'].split('/')[-1].split('?')[0]
|
|
56
|
-
except:
|
|
57
|
-
try:
|
|
58
|
-
self.__anc_resort_id = self.__data['ancestorResortId'].split(';')[0]
|
|
59
|
-
except:
|
|
60
|
-
self.__anc_resort_id = None
|
|
61
|
-
|
|
62
|
-
try:
|
|
63
|
-
self.__anc_land_id = self.__data['links']['ancestorLand']['href'].split('/')[-1].split('?')[0]
|
|
64
|
-
except:
|
|
65
|
-
try:
|
|
66
|
-
self.__anc_land_id = self.__data['ancestorLandId'].split(';')[0]
|
|
67
|
-
except:
|
|
68
|
-
self.__anc_land_id = None
|
|
69
|
-
|
|
70
|
-
try:
|
|
71
|
-
self.__anc_ra_id = self.__data['links']['ancestorResortArea']['href'].split('/')[-1].split('?')[0]
|
|
72
|
-
except:
|
|
73
|
-
try:
|
|
74
|
-
self.__anc_ra_id = self.__data['ancestorResortAreaId'].split(';')[0]
|
|
75
|
-
except:
|
|
76
|
-
self.__anc_ra_id = None
|
|
77
|
-
|
|
78
|
-
try:
|
|
79
|
-
self.__anc_ev_id = self.__data['links']['ancestorEntertainmentVenue']['href'].split('/')[-1].split('?')[0]
|
|
80
|
-
except:
|
|
81
|
-
try:
|
|
82
|
-
self.__anc_ev_id = self.__data['ancestorEntertainmentVenueId'].split(';')[0]
|
|
83
|
-
except:
|
|
84
|
-
self.__anc_ev_id = None
|
|
85
|
-
|
|
86
|
-
if self.__anc_dest_id == WDW_ID:
|
|
87
|
-
self.__time_zone = pytz.timezone('US/Eastern')
|
|
88
|
-
elif self.__anc_dest_id == DLR_ID:
|
|
89
|
-
self.__time_zone = pytz.timezone('US/Pacific')
|
|
90
|
-
else:
|
|
91
|
-
self.__time_zone = pytz.utc
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def get_possible_ids(self):
|
|
95
|
-
"""Returns a list of possible ids of this entityType"""
|
|
96
|
-
ids = []
|
|
97
|
-
|
|
98
|
-
dest_data = requests.get("https://api.wdpro.disney.go.com/facility-service/destinations/{}".format(self.__anc_dest_id), headers=get_headers()).json()
|
|
99
|
-
data = requests.get(dest_data['links']['entertainmentVenues']['href'], headers=get_headers()).json()
|
|
100
|
-
|
|
101
|
-
for entry in data['entries']:
|
|
102
|
-
try:
|
|
103
|
-
ids.append(entry['links']['self']['href'].split('/')[-1].split('?')[0])
|
|
104
|
-
except:
|
|
105
|
-
pass
|
|
106
|
-
|
|
107
|
-
return ids
|
|
108
|
-
|
|
109
|
-
def get_id(self):
|
|
110
|
-
"""Return object id"""
|
|
111
|
-
return self.__id
|
|
112
|
-
|
|
113
|
-
def get_name(self):
|
|
114
|
-
"""Return object name"""
|
|
115
|
-
return self.__name
|
|
116
|
-
|
|
117
|
-
def get_entityType(self):
|
|
118
|
-
"""Return object entityType"""
|
|
119
|
-
return self.__entityType
|
|
120
|
-
|
|
121
|
-
def get_subType(self):
|
|
122
|
-
"""Return object subType"""
|
|
123
|
-
return self.__subType
|
|
124
|
-
|
|
125
|
-
def get_ancestor_destination_id(self):
|
|
126
|
-
"""Return object ancestor destination id"""
|
|
127
|
-
return self.__anc_dest_id
|
|
128
|
-
|
|
129
|
-
def get_ancestor_park_id(self):
|
|
130
|
-
"""Return object ancestor theme or water park id"""
|
|
131
|
-
return self.__anc_park_id
|
|
132
|
-
|
|
133
|
-
def get_ancestor_resort_id(self):
|
|
134
|
-
"""Return object ancestor resort id"""
|
|
135
|
-
return self.__anc_resort_id
|
|
136
|
-
|
|
137
|
-
def get_ancestor_land_id(self):
|
|
138
|
-
"""Return object land id"""
|
|
139
|
-
return self.__anc_land_id
|
|
140
|
-
|
|
141
|
-
def get_ancestor_resort_area_id(self):
|
|
142
|
-
"""Return object resort area id"""
|
|
143
|
-
return self.__anc_ra_id
|
|
144
|
-
|
|
145
|
-
def get_ancestor_entertainment_venue_id(self):
|
|
146
|
-
"""Return object entertainment venue id"""
|
|
147
|
-
return self.__anc_ev_id
|
|
148
|
-
|
|
149
|
-
def get_links(self):
|
|
150
|
-
"""Returns a dictionary of related links"""
|
|
151
|
-
return self.__data['links']
|
|
152
|
-
|
|
153
|
-
def get_time_zone(self):
|
|
154
|
-
"""Returns pytz timezone object"""
|
|
155
|
-
return self.__time_zone
|
|
156
|
-
|
|
157
|
-
def get_raw_data(self):
|
|
158
|
-
"""Returns the raw data from global-facility-service"""
|
|
159
|
-
return self.__data
|
|
160
|
-
|
|
161
|
-
def get_coordinates(self):
|
|
162
|
-
"""Returns the object's latitude and longitude"""
|
|
163
|
-
try:
|
|
164
|
-
return self.__data['coordinates']['Guest Entrance']['gps']
|
|
165
|
-
except:
|
|
166
|
-
return None
|
|
167
|
-
|
|
168
|
-
def get_description(self):
|
|
169
|
-
"""Returns the object's descriptions"""
|
|
170
|
-
try:
|
|
171
|
-
long_desc = self.__data["descriptions"]["MM - " + self.__name]["text"].replace("<p>", "").split('</p>')[0]
|
|
172
|
-
return long_desc
|
|
173
|
-
except:
|
|
174
|
-
return None
|
|
175
|
-
|
|
176
|
-
def get_media(self):
|
|
177
|
-
"""Returns a dictionary of dictionaries of media relating to the entity"""
|
|
178
|
-
facility_data = self.__data
|
|
179
|
-
if facility_data is None:
|
|
180
|
-
return None
|
|
181
|
-
else:
|
|
182
|
-
return facility_data['media']
|
|
183
|
-
|
|
184
|
-
def get_hours(self, date = ""):
|
|
185
|
-
"""
|
|
186
|
-
Gets the object's hours on a specific day and returns them as a datetime object.
|
|
187
|
-
Returns the object's hours in the following order: operating open, operating close, Extra Magic open, Extra Magic close.
|
|
188
|
-
Extra Magic hours will return None if there are none for today.
|
|
189
|
-
If all hours are None then Disney has no hours for that day.
|
|
190
|
-
date = "YEAR-MONTH-DATE"
|
|
191
|
-
If you don't pass a date, it will get today's hours
|
|
192
|
-
"""
|
|
193
|
-
|
|
194
|
-
if date == "":
|
|
195
|
-
DATE = datetime.today()
|
|
196
|
-
else:
|
|
197
|
-
year, month, day = date.split('-')
|
|
198
|
-
DATE = datetime(int(year), int(month), int(day))
|
|
199
|
-
|
|
200
|
-
s = requests.get("https://api.wdpro.disney.go.com/facility-service/schedules/{}?date={}-{}-{}".format(self.__id, DATE.year, self.__formatDate(str(DATE.month)), self.__formatDate(str(DATE.day))), headers=get_headers())
|
|
201
|
-
data = json.loads(s.content)
|
|
202
|
-
|
|
203
|
-
operating_hours_start = None
|
|
204
|
-
operating_hours_end = None
|
|
205
|
-
extra_hours_start = None
|
|
206
|
-
extra_hours_end = None
|
|
207
|
-
|
|
208
|
-
try:
|
|
209
|
-
for i in range(len(data['schedules'])):
|
|
210
|
-
if data['schedules'][i]['type'] == 'Operating':
|
|
211
|
-
operating_hours_start = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['startTime'][0:2]), int(data['schedules'][i]['startTime'][3:5]))
|
|
212
|
-
if int(data['schedules'][i]['endTime'][0:2]) >= 0 and int(data['schedules'][i]['endTime'][0:2]) <= 7:
|
|
213
|
-
DATETEMP = DATE + timedelta(days=1)
|
|
214
|
-
operating_hours_end = datetime(DATETEMP.year, DATETEMP.month, DATETEMP.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
215
|
-
else:
|
|
216
|
-
operating_hours_end = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
217
|
-
|
|
218
|
-
if data['schedules'][i]['type'] == "Special Ticketed Event":
|
|
219
|
-
extra_hours_start = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['startTime'][0:2]), int(data['schedules'][i]['startTime'][3:5]))
|
|
220
|
-
if int(data['schedules'][i]['endTime'][0:2]) >= 0 and int(data['schedules'][i]['endTime'][0:2]) <= 7:
|
|
221
|
-
DATETEMP = DATE + timedelta(days=1)
|
|
222
|
-
extra_hours_end = datetime(DATETEMP.year, DATETEMP.month, DATETEMP.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
223
|
-
else:
|
|
224
|
-
operating_hours_end = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
225
|
-
|
|
226
|
-
except KeyError:
|
|
227
|
-
pass
|
|
228
|
-
return operating_hours_start, operating_hours_end, extra_hours_start, extra_hours_end
|
|
229
|
-
|
|
230
|
-
def get_advisories(self):
|
|
231
|
-
"""
|
|
232
|
-
Gets all the advisories for the venue and returns a list in the form of [{id, name}].
|
|
233
|
-
May take some time because it has to go to every link for each advisory.
|
|
234
|
-
"""
|
|
235
|
-
|
|
236
|
-
advisories = []
|
|
237
|
-
|
|
238
|
-
for i in range(len(self.__data['advisories'])):
|
|
239
|
-
data = requests.get(self.__data['advisories'][i]['links']['self']['href'], headers=get_headers()).json()
|
|
240
|
-
this = {}
|
|
241
|
-
this['id'] = data['id']
|
|
242
|
-
this['name'] = data['name']
|
|
243
|
-
advisories.append(this)
|
|
244
|
-
|
|
245
|
-
return advisories
|
|
246
|
-
|
|
247
|
-
def __formatDate(self, num):
|
|
248
|
-
"""
|
|
249
|
-
Formats month and day into proper format
|
|
250
|
-
"""
|
|
251
|
-
if len(num) < 2:
|
|
252
|
-
num = '0'+num
|
|
253
|
-
return num
|
|
254
|
-
|
|
255
|
-
def __eq__(self, other):
|
|
256
|
-
"""
|
|
257
|
-
Checks if objects are equal
|
|
258
|
-
"""
|
|
259
|
-
return self.__id == other.get_id()
|
|
260
|
-
|
|
261
|
-
def __str__(self):
|
|
262
|
-
return 'Entertainment Venue object for {}'.format(self.__name)
|
|
263
|
-
|
|
264
|
-
# TODO get attraction_ids
|
mousetools/facilities.py
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import json
|
|
3
|
-
import pytz
|
|
4
|
-
from datetime import datetime, timedelta
|
|
5
|
-
from .auth import get_headers
|
|
6
|
-
from .ids import WDW_ID, DLR_ID
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Facility(object):
|
|
10
|
-
|
|
11
|
-
def __init__(self, id = None):
|
|
12
|
-
"""
|
|
13
|
-
Constructor Function
|
|
14
|
-
Gets all facility data available and stores various elements into variables.
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
error = True
|
|
18
|
-
self.__data = requests.get("https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/facilities/{}".format(id), headers=get_headers()).json()
|
|
19
|
-
try:
|
|
20
|
-
if self.__data['id'] is not None:
|
|
21
|
-
error = False
|
|
22
|
-
except:
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
if error:
|
|
26
|
-
raise ValueError('That facility is not available. id: ' + str(id))
|
|
27
|
-
|
|
28
|
-
self.__id = id
|
|
29
|
-
self.__name = self.__data['name']
|
|
30
|
-
self.__entityType = self.__data['type']
|
|
31
|
-
try:
|
|
32
|
-
self.__subType = self.__data['subType']
|
|
33
|
-
except:
|
|
34
|
-
self.__subType = None
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
self.__anc_dest_id = self.__data['ancestorDestination']['id'].split(';')[0]
|
|
38
|
-
except:
|
|
39
|
-
self.__anc_dest_id = None
|
|
40
|
-
|
|
41
|
-
try:
|
|
42
|
-
self.__anc_park_id = self.__data['links']['ancestorThemePark']['href'].split('/')[-1].split('?')[0]
|
|
43
|
-
except:
|
|
44
|
-
try:
|
|
45
|
-
self.__anc_park_id = self.__data['links']['ancestorWaterPark']['href'].split('/')[-1].split('?')[0]
|
|
46
|
-
except:
|
|
47
|
-
try:
|
|
48
|
-
self.__anc_park_id = self.__data['ancestorThemeParkId'].split(';')[0]
|
|
49
|
-
except:
|
|
50
|
-
try:
|
|
51
|
-
self.__anc_park_id = self.__data['ancestorWaterParkId'].split(';')[0]
|
|
52
|
-
except:
|
|
53
|
-
self.__anc_park_id = None
|
|
54
|
-
|
|
55
|
-
try:
|
|
56
|
-
self.__anc_resort_id = self.__data['links']['ancestorResort']['href'].split('/')[-1].split('?')[0]
|
|
57
|
-
except:
|
|
58
|
-
try:
|
|
59
|
-
self.__anc_resort_id = self.__data['ancestorResortId'].split(';')[0]
|
|
60
|
-
except:
|
|
61
|
-
self.__anc_resort_id = None
|
|
62
|
-
|
|
63
|
-
try:
|
|
64
|
-
self.__anc_land_id = self.__data['links']['ancestorLand']['href'].split('/')[-1].split('?')[0]
|
|
65
|
-
except:
|
|
66
|
-
try:
|
|
67
|
-
self.__anc_land_id = self.__data['ancestorLandId'].split(';')[0]
|
|
68
|
-
except:
|
|
69
|
-
self.__anc_land_id = None
|
|
70
|
-
|
|
71
|
-
try:
|
|
72
|
-
self.__anc_ra_id = self.__data['links']['ancestorResortArea']['href'].split('/')[-1].split('?')[0]
|
|
73
|
-
except:
|
|
74
|
-
try:
|
|
75
|
-
self.__anc_ra_id = self.__data['ancestorResortAreaId'].split(';')[0]
|
|
76
|
-
except:
|
|
77
|
-
self.__anc_ra_id = None
|
|
78
|
-
|
|
79
|
-
try:
|
|
80
|
-
self.__anc_ev_id = self.__data['links']['ancestorEntertainmentVenue']['href'].split('/')[-1].split('?')[0]
|
|
81
|
-
except:
|
|
82
|
-
try:
|
|
83
|
-
self.__anc_ev_id = self.__data['ancestorEntertainmentVenueId'].split(';')[0]
|
|
84
|
-
except:
|
|
85
|
-
self.__anc_ev_id = None
|
|
86
|
-
|
|
87
|
-
if self.__anc_dest_id == WDW_ID:
|
|
88
|
-
self.__time_zone = pytz.timezone('US/Eastern')
|
|
89
|
-
elif self.__anc_dest_id == DLR_ID:
|
|
90
|
-
self.__time_zone = pytz.timezone('US/Pacific')
|
|
91
|
-
else:
|
|
92
|
-
self.__time_zone = pytz.utc
|
|
93
|
-
|
|
94
|
-
# There are just too many variations, could explore more
|
|
95
|
-
# def get_possible_ids(self):
|
|
96
|
-
# """Returns a list of possible ids of this entityType"""
|
|
97
|
-
# ids = []
|
|
98
|
-
|
|
99
|
-
# dest_data = requests.get("https://api.wdpro.disney.go.com/facility-service/destinations/{}".format(self.__anc_dest_id), headers=get_headers()).json()
|
|
100
|
-
# data = requests.get(dest_data['links']['facilities']['href'], headers=get_headers()).json()
|
|
101
|
-
|
|
102
|
-
# for entry in data['entries']:
|
|
103
|
-
# try:
|
|
104
|
-
# ids.append(entry['links']['self']['href'].split('/')[-1].split('?')[0])
|
|
105
|
-
# except:
|
|
106
|
-
# pass
|
|
107
|
-
|
|
108
|
-
# return ids
|
|
109
|
-
|
|
110
|
-
def get_id(self):
|
|
111
|
-
"""Return object id"""
|
|
112
|
-
return self.__id
|
|
113
|
-
|
|
114
|
-
def get_name(self):
|
|
115
|
-
"""Return object name"""
|
|
116
|
-
return self.__name
|
|
117
|
-
|
|
118
|
-
def get_entityType(self):
|
|
119
|
-
"""Return object entityType"""
|
|
120
|
-
return self.__entityType
|
|
121
|
-
|
|
122
|
-
def get_subType(self):
|
|
123
|
-
"""Return object subType"""
|
|
124
|
-
return self.__subType
|
|
125
|
-
|
|
126
|
-
def get_ancestor_destination_id(self):
|
|
127
|
-
"""Return object ancestor destination id"""
|
|
128
|
-
return self.__anc_dest_id
|
|
129
|
-
|
|
130
|
-
def get_ancestor_park_id(self):
|
|
131
|
-
"""Return object ancestor theme or water park id"""
|
|
132
|
-
return self.__anc_park_id
|
|
133
|
-
|
|
134
|
-
def get_ancestor_resort_id(self):
|
|
135
|
-
"""Return object ancestor resort id"""
|
|
136
|
-
return self.__anc_resort_id
|
|
137
|
-
|
|
138
|
-
def get_ancestor_land_id(self):
|
|
139
|
-
"""Return object land id"""
|
|
140
|
-
return self.__anc_land_id
|
|
141
|
-
|
|
142
|
-
def get_ancestor_resort_area_id(self):
|
|
143
|
-
"""Return object resort area id"""
|
|
144
|
-
return self.__anc_ra_id
|
|
145
|
-
|
|
146
|
-
def get_ancestor_entertainment_venue_id(self):
|
|
147
|
-
"""Return object entertainment venue id"""
|
|
148
|
-
return self.__anc_ev_id
|
|
149
|
-
|
|
150
|
-
def get_links(self):
|
|
151
|
-
"""Returns a dictionary of related links"""
|
|
152
|
-
return self.__data['links']
|
|
153
|
-
|
|
154
|
-
def get_time_zone(self):
|
|
155
|
-
"""Returns pytz timezone object"""
|
|
156
|
-
return self.__time_zone
|
|
157
|
-
|
|
158
|
-
def get_coordinates(self):
|
|
159
|
-
"""Returns the object's latitude and longitude"""
|
|
160
|
-
try:
|
|
161
|
-
return self.__data['coordinates']['Guest Entrance']['gps']
|
|
162
|
-
except:
|
|
163
|
-
return None
|
|
164
|
-
|
|
165
|
-
def get_description(self):
|
|
166
|
-
"""Returns the object's description"""
|
|
167
|
-
facility_data = self.__data
|
|
168
|
-
if facility_data is None:
|
|
169
|
-
return None
|
|
170
|
-
else:
|
|
171
|
-
try:
|
|
172
|
-
return facility_data['descriptions']['shortDescription']['sections']['body']
|
|
173
|
-
except:
|
|
174
|
-
return None
|
|
175
|
-
|
|
176
|
-
def get_media(self):
|
|
177
|
-
"""Returns a dictionary of dictionaries of media relating to the entity"""
|
|
178
|
-
facility_data = self.__data
|
|
179
|
-
if facility_data is None:
|
|
180
|
-
return None
|
|
181
|
-
else:
|
|
182
|
-
return facility_data['media']
|
|
183
|
-
|
|
184
|
-
def get_facets(self):
|
|
185
|
-
"""Returns a list of dictionaries of the object's facets"""
|
|
186
|
-
facility_data = self.__data
|
|
187
|
-
if facility_data is None:
|
|
188
|
-
return None
|
|
189
|
-
else:
|
|
190
|
-
try:
|
|
191
|
-
return facility_data['facets']
|
|
192
|
-
except:
|
|
193
|
-
return None
|
|
194
|
-
|
|
195
|
-
def get_todays_hours(self, date=""):
|
|
196
|
-
"""
|
|
197
|
-
Gets the object's hours on a specific day and returns them as a datetime object.
|
|
198
|
-
Returns the object's hours in the following order: operating open, operating close, Extra Magic open, Extra Magic close.
|
|
199
|
-
Extra Magic hours will return None if there are none for today.
|
|
200
|
-
If all hours are None then Disney has no hours for that day.
|
|
201
|
-
date = "yyyy-mm-dd"
|
|
202
|
-
If you don't pass a date, it will get today's hours
|
|
203
|
-
"""
|
|
204
|
-
|
|
205
|
-
if date == "":
|
|
206
|
-
DATE = datetime.today()
|
|
207
|
-
else:
|
|
208
|
-
year, month, day = date.split('-')
|
|
209
|
-
DATE = datetime(int(year), int(month), int(day))
|
|
210
|
-
|
|
211
|
-
s = requests.get("https://api.wdpro.disney.go.com/facility-service/schedules/{}?date={}-{}-{}".format(self.__id, DATE.year, self.__formatDate(str(DATE.month)), self.__formatDate(str(DATE.day))), headers=get_headers())
|
|
212
|
-
data = json.loads(s.content)
|
|
213
|
-
|
|
214
|
-
operating_hours_start = None
|
|
215
|
-
operating_hours_end = None
|
|
216
|
-
extra_hours_start = None
|
|
217
|
-
extra_hours_end = None
|
|
218
|
-
|
|
219
|
-
try:
|
|
220
|
-
for i in range(len(data['schedules'])):
|
|
221
|
-
if data['schedules'][i]['type'] == 'Operating':
|
|
222
|
-
operating_hours_start = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['startTime'][0:2]), int(data['schedules'][i]['startTime'][3:5]))
|
|
223
|
-
if int(data['schedules'][i]['endTime'][0:2]) >= 0 and int(data['schedules'][i]['endTime'][0:2]) <= 7:
|
|
224
|
-
DATETEMP = DATE + timedelta(days=1)
|
|
225
|
-
operating_hours_end = datetime(DATETEMP.year, DATETEMP.month, DATETEMP.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
226
|
-
else:
|
|
227
|
-
operating_hours_end = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
228
|
-
|
|
229
|
-
if data['schedules'][i]['type'] == "Special Ticketed Event":
|
|
230
|
-
extra_hours_start = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['startTime'][0:2]), int(data['schedules'][i]['startTime'][3:5]))
|
|
231
|
-
if int(data['schedules'][i]['endTime'][0:2]) >= 0 and int(data['schedules'][i]['endTime'][0:2]) <= 7:
|
|
232
|
-
DATETEMP = DATE + timedelta(days=1)
|
|
233
|
-
extra_hours_end = datetime(DATETEMP.year, DATETEMP.month, DATETEMP.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
234
|
-
else:
|
|
235
|
-
operating_hours_end = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
236
|
-
|
|
237
|
-
except KeyError:
|
|
238
|
-
pass
|
|
239
|
-
return operating_hours_start, operating_hours_end, extra_hours_start, extra_hours_end
|
|
240
|
-
|
|
241
|
-
def __eq__(self, other):
|
|
242
|
-
"""
|
|
243
|
-
Checks if objects are equal
|
|
244
|
-
"""
|
|
245
|
-
return self.__id == other.get_id()
|
|
246
|
-
|
|
247
|
-
def __str__(self):
|
|
248
|
-
return 'Facility object for {}'.format(self.__name)
|