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
mousetools/parks.py
DELETED
|
@@ -1,446 +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 themeparkapi_ids, WDW_ID, DLR_ID
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Park(object):
|
|
10
|
-
|
|
11
|
-
def __init__(self, id = None):
|
|
12
|
-
"""
|
|
13
|
-
Constructor Function
|
|
14
|
-
Gets all park 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/theme-parks/{}".format(id), headers=get_headers()).json()
|
|
19
|
-
try:
|
|
20
|
-
if self.__data['id'] is not None:
|
|
21
|
-
error = False
|
|
22
|
-
except:
|
|
23
|
-
self.__data = requests.get("https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/water-parks/{}".format(id), headers=get_headers()).json()
|
|
24
|
-
try:
|
|
25
|
-
if self.__data['id'] is not None:
|
|
26
|
-
error = False
|
|
27
|
-
except:
|
|
28
|
-
pass
|
|
29
|
-
|
|
30
|
-
if error:
|
|
31
|
-
raise ValueError('That park is not available. id: ' + str(id))
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
self.__id = id
|
|
36
|
-
self.__name = self.__data['name']
|
|
37
|
-
self.__entityType = self.__data['type']
|
|
38
|
-
try:
|
|
39
|
-
self.__subType = self.__data['subType']
|
|
40
|
-
except:
|
|
41
|
-
self.__subType = None
|
|
42
|
-
|
|
43
|
-
try:
|
|
44
|
-
self.__anc_dest_id = self.__data['ancestorDestination']['id'].split(';')[0]
|
|
45
|
-
except:
|
|
46
|
-
self.__anc_dest_id = None
|
|
47
|
-
|
|
48
|
-
try:
|
|
49
|
-
self.__anc_park_id = self.__data['links']['ancestorThemePark']['href'].split('/')[-1].split('?')[0]
|
|
50
|
-
except:
|
|
51
|
-
try:
|
|
52
|
-
self.__anc_park_id = self.__data['links']['ancestorWaterPark']['href'].split('/')[-1].split('?')[0]
|
|
53
|
-
except:
|
|
54
|
-
try:
|
|
55
|
-
self.__anc_park_id = self.__data['ancestorThemeParkId'].split(';')[0]
|
|
56
|
-
except:
|
|
57
|
-
try:
|
|
58
|
-
self.__anc_park_id = self.__data['ancestorWaterParkId'].split(';')[0]
|
|
59
|
-
except:
|
|
60
|
-
self.__anc_park_id = None
|
|
61
|
-
|
|
62
|
-
try:
|
|
63
|
-
self.__anc_resort_id = self.__data['links']['ancestorResort']['href'].split('/')[-1].split('?')[0]
|
|
64
|
-
except:
|
|
65
|
-
try:
|
|
66
|
-
self.__anc_resort_id = self.__data['ancestorResortId'].split(';')[0]
|
|
67
|
-
except:
|
|
68
|
-
self.__anc_resort_id = None
|
|
69
|
-
|
|
70
|
-
try:
|
|
71
|
-
self.__anc_land_id = self.__data['links']['ancestorLand']['href'].split('/')[-1].split('?')[0]
|
|
72
|
-
except:
|
|
73
|
-
try:
|
|
74
|
-
self.__anc_land_id = self.__data['ancestorLandId'].split(';')[0]
|
|
75
|
-
except:
|
|
76
|
-
self.__anc_land_id = None
|
|
77
|
-
|
|
78
|
-
try:
|
|
79
|
-
self.__anc_ra_id = self.__data['links']['ancestorResortArea']['href'].split('/')[-1].split('?')[0]
|
|
80
|
-
except:
|
|
81
|
-
try:
|
|
82
|
-
self.__anc_ra_id = self.__data['ancestorResortAreaId'].split(';')[0]
|
|
83
|
-
except:
|
|
84
|
-
self.__anc_ra_id = None
|
|
85
|
-
|
|
86
|
-
try:
|
|
87
|
-
self.__anc_ev_id = self.__data['links']['ancestorEntertainmentVenue']['href'].split('/')[-1].split('?')[0]
|
|
88
|
-
except:
|
|
89
|
-
try:
|
|
90
|
-
self.__anc_ev_id = self.__data['ancestorEntertainmentVenueId'].split(';')[0]
|
|
91
|
-
except:
|
|
92
|
-
self.__anc_ev_id = None
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if self.__anc_dest_id == WDW_ID:
|
|
96
|
-
self.__time_zone = pytz.timezone('US/Eastern')
|
|
97
|
-
elif self.__anc_dest_id == DLR_ID:
|
|
98
|
-
self.__time_zone = pytz.timezone('US/Pacific')
|
|
99
|
-
else:
|
|
100
|
-
self.__time_zone = pytz.utc
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def get_possible_ids(self):
|
|
104
|
-
"""Returns a list of possible ids of this entityType"""
|
|
105
|
-
ids = []
|
|
106
|
-
|
|
107
|
-
dest_data = requests.get("https://api.wdpro.disney.go.com/facility-service/destinations/{}".format(self.__anc_dest_id), headers=get_headers()).json()
|
|
108
|
-
data = requests.get(dest_data['links']['themeParks']['href'], headers=get_headers()).json()
|
|
109
|
-
|
|
110
|
-
for entry in data['entries']:
|
|
111
|
-
try:
|
|
112
|
-
ids.append(entry['links']['self']['href'].split('/')[-1].split('?')[0])
|
|
113
|
-
except:
|
|
114
|
-
pass
|
|
115
|
-
|
|
116
|
-
data = requests.get(dest_data['links']['waterParks']['href'], headers=get_headers()).json()
|
|
117
|
-
try:
|
|
118
|
-
for entry in data['entries']:
|
|
119
|
-
try:
|
|
120
|
-
ids.append(entry['links']['self']['href'].split('/')[-1].split('?')[0])
|
|
121
|
-
except:
|
|
122
|
-
pass
|
|
123
|
-
except:
|
|
124
|
-
pass
|
|
125
|
-
|
|
126
|
-
return ids
|
|
127
|
-
|
|
128
|
-
def get_id(self):
|
|
129
|
-
"""Return object id"""
|
|
130
|
-
return self.__id
|
|
131
|
-
|
|
132
|
-
def get_name(self):
|
|
133
|
-
"""Return object name"""
|
|
134
|
-
return self.__name
|
|
135
|
-
|
|
136
|
-
def get_entityType(self):
|
|
137
|
-
"""Return object entityType"""
|
|
138
|
-
return self.__entityType
|
|
139
|
-
|
|
140
|
-
def get_subType(self):
|
|
141
|
-
"""Return object subType"""
|
|
142
|
-
return self.__subType
|
|
143
|
-
|
|
144
|
-
def get_ancestor_destination_id(self):
|
|
145
|
-
"""Return object ancestor destination id"""
|
|
146
|
-
return self.__anc_dest_id
|
|
147
|
-
|
|
148
|
-
def get_ancestor_park_id(self):
|
|
149
|
-
"""Return object ancestor theme or water park id"""
|
|
150
|
-
return self.__anc_park_id
|
|
151
|
-
|
|
152
|
-
def get_ancestor_resort_id(self):
|
|
153
|
-
"""Return object ancestor resort id"""
|
|
154
|
-
return self.__anc_resort_id
|
|
155
|
-
|
|
156
|
-
def get_ancestor_land_id(self):
|
|
157
|
-
"""Return object land id"""
|
|
158
|
-
return self.__anc_land_id
|
|
159
|
-
|
|
160
|
-
def get_ancestor_resort_area_id(self):
|
|
161
|
-
"""Return object resort area id"""
|
|
162
|
-
return self.__anc_ra_id
|
|
163
|
-
|
|
164
|
-
def get_ancestor_entertainment_venue_id(self):
|
|
165
|
-
"""Return object entertainment venue id"""
|
|
166
|
-
return self.__anc_ev_id
|
|
167
|
-
|
|
168
|
-
def get_links(self):
|
|
169
|
-
"""Returns a dictionary of related links"""
|
|
170
|
-
return self.__data['links']
|
|
171
|
-
|
|
172
|
-
def get_time_zone(self):
|
|
173
|
-
"""Returns pytz timezone object"""
|
|
174
|
-
return self.__time_zone
|
|
175
|
-
|
|
176
|
-
def get_raw_data(self):
|
|
177
|
-
"""Returns the raw data from global-facility-service"""
|
|
178
|
-
return self.__data
|
|
179
|
-
|
|
180
|
-
def get_themeparkapi_data(self):
|
|
181
|
-
"""Returns the list of dictionaries from the themepark api for the given id"""
|
|
182
|
-
park = themeparkapi_ids[self.__anc_park_id]
|
|
183
|
-
all_data = requests.get(f"https://api.themeparks.wiki/preview/parks/{park}/waittime").json()
|
|
184
|
-
return all_data
|
|
185
|
-
|
|
186
|
-
def get_wait_times(self):
|
|
187
|
-
"""Returns a list of dictionaries in the form of {rideid:time} for attractions and entertainments for this park"""
|
|
188
|
-
data = self.get_themeparkapi_data()
|
|
189
|
-
|
|
190
|
-
times = {}
|
|
191
|
-
|
|
192
|
-
for i in data:
|
|
193
|
-
id = i['id'].split("_")[-1]
|
|
194
|
-
try:
|
|
195
|
-
if i['meta']['type'] != "RESTAURANT":
|
|
196
|
-
times[id] = i['waitTime']
|
|
197
|
-
except:
|
|
198
|
-
times[id] = i['waitTime']
|
|
199
|
-
|
|
200
|
-
return times
|
|
201
|
-
|
|
202
|
-
def get_wait_times_detailed(self):
|
|
203
|
-
"""Returns a list of dictionaries in the form of {rideid:{name, status, wait_time}} for attractions and entertainments for this park"""
|
|
204
|
-
data = self.get_themeparkapi_data()
|
|
205
|
-
|
|
206
|
-
times = {}
|
|
207
|
-
|
|
208
|
-
for i in data:
|
|
209
|
-
id = i['id'].split("_")[-1]
|
|
210
|
-
this = {}
|
|
211
|
-
try:
|
|
212
|
-
if i['meta']['type'] != "RESTAURANT":
|
|
213
|
-
|
|
214
|
-
update_time = datetime.strptime(i['lastUpdate'], "%Y-%m-%dT%H:%M:%S.%fZ")
|
|
215
|
-
update_time = update_time.replace(tzinfo=pytz.utc)
|
|
216
|
-
update_time = update_time.astimezone(self.__time_zone)
|
|
217
|
-
|
|
218
|
-
this['name'] = i['name']
|
|
219
|
-
this['status'] = i['status']
|
|
220
|
-
this['wait_time'] = i['waitTime']
|
|
221
|
-
this['last_updated'] = update_time
|
|
222
|
-
this['entityType'] = i['meta']['type'].capitalize()
|
|
223
|
-
times[id] = this
|
|
224
|
-
except:
|
|
225
|
-
|
|
226
|
-
update_time = datetime.strptime(i['lastUpdate'], "%Y-%m-%dT%H:%M:%S.%fZ")
|
|
227
|
-
update_time = update_time.replace(tzinfo=pytz.utc)
|
|
228
|
-
update_time = update_time.astimezone(self.__time_zone)
|
|
229
|
-
|
|
230
|
-
this['name'] = i['name']
|
|
231
|
-
this['status'] = i['status']
|
|
232
|
-
this['wait_time'] = i['waitTime']
|
|
233
|
-
this['last_updated'] = update_time
|
|
234
|
-
this['entityType'] = "Entertainment"
|
|
235
|
-
times[id] = this
|
|
236
|
-
|
|
237
|
-
return times
|
|
238
|
-
|
|
239
|
-
def get_attraction_wait_times(self):
|
|
240
|
-
"""Returns a list of dictionaries in the form of {rideid:time} for attractions for this park"""
|
|
241
|
-
data = self.get_themeparkapi_data()
|
|
242
|
-
|
|
243
|
-
times = {}
|
|
244
|
-
|
|
245
|
-
for i in data:
|
|
246
|
-
id = i['id'].split("_")[-1]
|
|
247
|
-
try:
|
|
248
|
-
if i['meta']['type'] == "ATTRACTION":
|
|
249
|
-
times[id] = i['waitTime']
|
|
250
|
-
except:
|
|
251
|
-
continue
|
|
252
|
-
|
|
253
|
-
return times
|
|
254
|
-
|
|
255
|
-
def get_attraction_wait_times_detailed(self):
|
|
256
|
-
"""Returns a list of dictionaries in the form of {rideid:{name, status, wait_time}} for attractions for this park"""
|
|
257
|
-
data = self.get_themeparkapi_data()
|
|
258
|
-
|
|
259
|
-
times = {}
|
|
260
|
-
|
|
261
|
-
for i in data:
|
|
262
|
-
id = i['id'].split("_")[-1]
|
|
263
|
-
this = {}
|
|
264
|
-
try:
|
|
265
|
-
if i['meta']['type'] == "ATTRACTION":
|
|
266
|
-
|
|
267
|
-
update_time = datetime.strptime(i['lastUpdate'], "%Y-%m-%dT%H:%M:%S.%fZ")
|
|
268
|
-
update_time = update_time.replace(tzinfo=pytz.utc)
|
|
269
|
-
update_time = update_time.astimezone(self.__time_zone)
|
|
270
|
-
|
|
271
|
-
this['name'] = i['name']
|
|
272
|
-
this['status'] = i['status']
|
|
273
|
-
this['wait_time'] = i['waitTime']
|
|
274
|
-
this['last_updated'] = update_time
|
|
275
|
-
this['entityType'] = i['meta']['type'].capitalize()
|
|
276
|
-
times[id] = this
|
|
277
|
-
except:
|
|
278
|
-
continue
|
|
279
|
-
|
|
280
|
-
return times
|
|
281
|
-
|
|
282
|
-
def get_entertainment_wait_times(self):
|
|
283
|
-
"""Returns a list of dictionaries in the form of {rideid:time} for entertainments for this park"""
|
|
284
|
-
data = self.get_themeparkapi_data()
|
|
285
|
-
|
|
286
|
-
times = {}
|
|
287
|
-
|
|
288
|
-
for i in data:
|
|
289
|
-
id = i['id'].split("_")[-1]
|
|
290
|
-
if 'type' not in i['meta'].keys():
|
|
291
|
-
times[id] = i['waitTime']
|
|
292
|
-
|
|
293
|
-
return times
|
|
294
|
-
|
|
295
|
-
def get_entertainment_wait_times_detailed(self):
|
|
296
|
-
"""Returns a list of dictionaries in the form of {rideid:{name, status, wait_time}} for entertainments for this park"""
|
|
297
|
-
data = self.get_themeparkapi_data()
|
|
298
|
-
|
|
299
|
-
times = {}
|
|
300
|
-
|
|
301
|
-
for i in data:
|
|
302
|
-
id = i['id'].split("_")[-1]
|
|
303
|
-
this = {}
|
|
304
|
-
if 'type' not in i['meta'].keys():
|
|
305
|
-
|
|
306
|
-
update_time = datetime.strptime(i['lastUpdate'], "%Y-%m-%dT%H:%M:%S.%fZ")
|
|
307
|
-
update_time = update_time.replace(tzinfo=pytz.utc)
|
|
308
|
-
update_time = update_time.astimezone(self.__time_zone)
|
|
309
|
-
|
|
310
|
-
this['name'] = i['name']
|
|
311
|
-
this['status'] = i['status']
|
|
312
|
-
this['wait_time'] = i['waitTime']
|
|
313
|
-
this['last_updated'] = update_time
|
|
314
|
-
this['entityType'] = "Entertainment"
|
|
315
|
-
times[id] = this
|
|
316
|
-
|
|
317
|
-
return times
|
|
318
|
-
|
|
319
|
-
# Figure out how to get the current status
|
|
320
|
-
# def get_status(self):
|
|
321
|
-
# """Return current status of the object."""
|
|
322
|
-
# park = themeparkapi_ids[self.__anc_park_id]
|
|
323
|
-
# all_data = requests.get(f"https://api.themeparks.wiki/preview/parks/{park}/calendar").json()
|
|
324
|
-
|
|
325
|
-
def get_coordinates(self):
|
|
326
|
-
"""Returns the object's latitude and longitude"""
|
|
327
|
-
try:
|
|
328
|
-
return self.__data['coordinates']['Guest Entrance']['gps']
|
|
329
|
-
except:
|
|
330
|
-
return None
|
|
331
|
-
|
|
332
|
-
def get_description(self):
|
|
333
|
-
"""Returns the object's descriptions"""
|
|
334
|
-
try:
|
|
335
|
-
long_desc = self.__data["descriptions"]["MM - " + self.__name]["text"].replace("<p>", "").split('</p>')[0]
|
|
336
|
-
return long_desc
|
|
337
|
-
except:
|
|
338
|
-
return None
|
|
339
|
-
|
|
340
|
-
def get_media(self):
|
|
341
|
-
"""Returns a dictionary of dictionaries of media relating to the entity"""
|
|
342
|
-
facility_data = self.__data
|
|
343
|
-
if facility_data is None:
|
|
344
|
-
return None
|
|
345
|
-
else:
|
|
346
|
-
return facility_data['media']
|
|
347
|
-
|
|
348
|
-
def admission_required(self):
|
|
349
|
-
"""Returns boolean of admission required"""
|
|
350
|
-
return self.__data['admissionRequired']
|
|
351
|
-
|
|
352
|
-
def get_hours(self, date = ""):
|
|
353
|
-
"""
|
|
354
|
-
Gets the object's hours on a specific day and returns them as a datetime object.
|
|
355
|
-
Returns the object's hours in the following order: operating open, operating close, Extra Magic open, Extra Magic close.
|
|
356
|
-
Extra Magic hours will return None if there are none for today.
|
|
357
|
-
If all hours are None then Disney has no hours for that day.
|
|
358
|
-
date = "YYYY-MM-DD"
|
|
359
|
-
If you don't pass a date, it will get today's hours
|
|
360
|
-
"""
|
|
361
|
-
|
|
362
|
-
if date == "":
|
|
363
|
-
DATE = datetime.today()
|
|
364
|
-
else:
|
|
365
|
-
year, month, day = date.split('-')
|
|
366
|
-
DATE = datetime(int(year), int(month), int(day))
|
|
367
|
-
|
|
368
|
-
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())
|
|
369
|
-
data = json.loads(s.content)
|
|
370
|
-
|
|
371
|
-
operating_hours_start = None
|
|
372
|
-
operating_hours_end = None
|
|
373
|
-
extra_hours_start = None
|
|
374
|
-
extra_hours_end = None
|
|
375
|
-
|
|
376
|
-
try:
|
|
377
|
-
for i in range(len(data['schedules'])):
|
|
378
|
-
if data['schedules'][i]['type'] == 'Operating':
|
|
379
|
-
operating_hours_start = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['startTime'][0:2]), int(data['schedules'][i]['startTime'][3:5]))
|
|
380
|
-
if int(data['schedules'][i]['endTime'][0:2]) >= 0 and int(data['schedules'][i]['endTime'][0:2]) <= 7:
|
|
381
|
-
DATETEMP = DATE + timedelta(days=1)
|
|
382
|
-
operating_hours_end = datetime(DATETEMP.year, DATETEMP.month, DATETEMP.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
383
|
-
else:
|
|
384
|
-
operating_hours_end = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
385
|
-
|
|
386
|
-
if data['schedules'][i]['type'] == "Special Ticketed Event":
|
|
387
|
-
extra_hours_start = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['startTime'][0:2]), int(data['schedules'][i]['startTime'][3:5]))
|
|
388
|
-
if int(data['schedules'][i]['endTime'][0:2]) >= 0 and int(data['schedules'][i]['endTime'][0:2]) <= 7:
|
|
389
|
-
DATETEMP = DATE + timedelta(days=1)
|
|
390
|
-
extra_hours_end = datetime(DATETEMP.year, DATETEMP.month, DATETEMP.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
391
|
-
else:
|
|
392
|
-
operating_hours_end = datetime(DATE.year, DATE.month, DATE.day, int(data['schedules'][i]['endTime'][0:2]), int(data['schedules'][i]['endTime'][3:5]))
|
|
393
|
-
|
|
394
|
-
except KeyError:
|
|
395
|
-
pass
|
|
396
|
-
return operating_hours_start, operating_hours_end, extra_hours_start, extra_hours_end
|
|
397
|
-
|
|
398
|
-
def get_advisories(self):
|
|
399
|
-
"""
|
|
400
|
-
Gets all the advisories for the park and returns a list in the form of [{id, name}].
|
|
401
|
-
May take some time because it has to go to every link for each advisory.
|
|
402
|
-
"""
|
|
403
|
-
|
|
404
|
-
advisories = []
|
|
405
|
-
|
|
406
|
-
for i in range(len(self.__data['advisories'])):
|
|
407
|
-
data = requests.get(self.__data['advisories'][i]['links']['self']['href'], headers=get_headers()).json()
|
|
408
|
-
this = {}
|
|
409
|
-
this['id'] = data['id']
|
|
410
|
-
this['name'] = data['name']
|
|
411
|
-
advisories.append(this)
|
|
412
|
-
|
|
413
|
-
return advisories
|
|
414
|
-
|
|
415
|
-
def get_entertainment_ids(self):
|
|
416
|
-
"""Returns a list of entertainments for this object"""
|
|
417
|
-
ids = []
|
|
418
|
-
|
|
419
|
-
data = requests.get("https://api.wdpro.disney.go.com/facility-service/{}s/{}/entertainments?region=us".format(self.__entityType, self.__id), headers=get_headers()).json()
|
|
420
|
-
|
|
421
|
-
for entry in data['entries']:
|
|
422
|
-
try:
|
|
423
|
-
ids.append(entry['links']['self']['href'].split('/')[-1].split('?')[0])
|
|
424
|
-
except:
|
|
425
|
-
pass
|
|
426
|
-
|
|
427
|
-
return ids
|
|
428
|
-
|
|
429
|
-
def __formatDate(self, num):
|
|
430
|
-
"""
|
|
431
|
-
Formats month and day into proper format
|
|
432
|
-
"""
|
|
433
|
-
if len(num) < 2:
|
|
434
|
-
num = '0'+num
|
|
435
|
-
return num
|
|
436
|
-
|
|
437
|
-
def __eq__(self, other):
|
|
438
|
-
"""
|
|
439
|
-
Checks if objects are equal
|
|
440
|
-
"""
|
|
441
|
-
return self.__id == other.get_id()
|
|
442
|
-
|
|
443
|
-
def __str__(self):
|
|
444
|
-
return 'Park object for {}'.format(self.__name)
|
|
445
|
-
|
|
446
|
-
# TODO get attraction_ids
|
mousetools/pointsofinterest.py
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import pytz
|
|
3
|
-
from datetime import datetime, timedelta
|
|
4
|
-
from .auth import get_headers
|
|
5
|
-
from .ids import WDW_ID, DLR_ID
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class PointOfInterest(object):
|
|
9
|
-
|
|
10
|
-
def __init__(self, id = None):
|
|
11
|
-
"""
|
|
12
|
-
Constructor Function
|
|
13
|
-
Gets all points of interest 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/points-of-interest/{}".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 point of interest is not available. id: ' + str(id))
|
|
26
|
-
|
|
27
|
-
self.__id = id
|
|
28
|
-
self.__name = self.__data['name']
|
|
29
|
-
self.__entityType = self.__data['type']
|
|
30
|
-
try:
|
|
31
|
-
self.__subType = self.__data['subType']
|
|
32
|
-
except:
|
|
33
|
-
self.__subType = None
|
|
34
|
-
|
|
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
|
-
|
|
95
|
-
def get_id(self):
|
|
96
|
-
"""Return object id"""
|
|
97
|
-
return self.__id
|
|
98
|
-
|
|
99
|
-
def get_name(self):
|
|
100
|
-
"""Return object name"""
|
|
101
|
-
return self.__name
|
|
102
|
-
|
|
103
|
-
def get_entityType(self):
|
|
104
|
-
"""Return object entityType"""
|
|
105
|
-
return self.__entityType
|
|
106
|
-
|
|
107
|
-
def get_subType(self):
|
|
108
|
-
"""Return object subType"""
|
|
109
|
-
return self.__subType
|
|
110
|
-
|
|
111
|
-
def get_ancestor_destination_id(self):
|
|
112
|
-
"""Return object ancestor destination id"""
|
|
113
|
-
return self.__anc_dest_id
|
|
114
|
-
|
|
115
|
-
def get_ancestor_park_id(self):
|
|
116
|
-
"""Return object ancestor theme or water park id"""
|
|
117
|
-
return self.__anc_park_id
|
|
118
|
-
|
|
119
|
-
def get_ancestor_resort_id(self):
|
|
120
|
-
"""Return object ancestor resort id"""
|
|
121
|
-
return self.__anc_resort_id
|
|
122
|
-
|
|
123
|
-
def get_ancestor_land_id(self):
|
|
124
|
-
"""Return object land id"""
|
|
125
|
-
return self.__anc_land_id
|
|
126
|
-
|
|
127
|
-
def get_ancestor_resort_area_id(self):
|
|
128
|
-
"""Return object resort area id"""
|
|
129
|
-
return self.__anc_ra_id
|
|
130
|
-
|
|
131
|
-
def get_ancestor_entertainment_venue_id(self):
|
|
132
|
-
"""Return object entertainment venue id"""
|
|
133
|
-
return self.__anc_ev_id
|
|
134
|
-
|
|
135
|
-
def get_links(self):
|
|
136
|
-
"""Returns a dictionary of related links"""
|
|
137
|
-
return self.__data['links']
|
|
138
|
-
|
|
139
|
-
def get_time_zone(self):
|
|
140
|
-
"""Returns pytz timezone object"""
|
|
141
|
-
return self.__time_zone
|
|
142
|
-
|
|
143
|
-
def get_raw_data(self):
|
|
144
|
-
"""Returns the raw data from global-facility-service"""
|
|
145
|
-
return self.__data
|
|
146
|
-
|
|
147
|
-
def get_coordinates(self):
|
|
148
|
-
"""Returns the object's latitude and longitude"""
|
|
149
|
-
try:
|
|
150
|
-
return self.__data['coordinates']['Guest Entrance']['gps']
|
|
151
|
-
except:
|
|
152
|
-
return None
|
|
153
|
-
|
|
154
|
-
def get_description(self):
|
|
155
|
-
"""Returns the object's description"""
|
|
156
|
-
facility_data = self.__data
|
|
157
|
-
if facility_data is None:
|
|
158
|
-
return None
|
|
159
|
-
else:
|
|
160
|
-
try:
|
|
161
|
-
return facility_data['descriptions']['shortDescription']['sections']['body']
|
|
162
|
-
except:
|
|
163
|
-
return None
|
|
164
|
-
|
|
165
|
-
def get_media(self):
|
|
166
|
-
"""Returns a dictionary of dictionaries of media relating to the entity"""
|
|
167
|
-
facility_data = self.__data
|
|
168
|
-
if facility_data is None:
|
|
169
|
-
return None
|
|
170
|
-
else:
|
|
171
|
-
return facility_data['media']
|
|
172
|
-
|
|
173
|
-
def admission_required(self):
|
|
174
|
-
"""Returns boolean of admission required"""
|
|
175
|
-
return self.__data['admissionRequired']
|
|
176
|
-
|
|
177
|
-
def __formatDate(self, num):
|
|
178
|
-
"""
|
|
179
|
-
Formats month and day into proper format
|
|
180
|
-
"""
|
|
181
|
-
if len(num) < 2:
|
|
182
|
-
num = '0'+num
|
|
183
|
-
return num
|
|
184
|
-
|
|
185
|
-
def __str__(self):
|
|
186
|
-
return 'PointOfInterest object for {}'.format(self.__name)
|
|
File without changes
|