Exemple #1
0
    def getCurrentWaitTimes(self):
        authentication = get_header()
        s = requests.get(
            "https://api.wdpro.disney.go.com/facility-service/theme-parks/{}/wait-times"
            .format(self.__park_id),
            headers=authentication)
        wait_data = json.loads(s.content)

        wait_entries = wait_data['entries']
        ride_wait_data = {}
        for item in wait_entries:
            #print(item['id'].split(';')[0] + " " +item['name'])
            current_dict = {}
            current_dict["ride_id"] = item['id'].split(';')[0]
            current_dict["ride_name"] = item['name']
            wait_info = item['waitTime']
            if 'postedWaitMinutes' in wait_info:
                current_dict['wait_time'] = wait_info['postedWaitMinutes']
            if 'fastPass' in wait_info:
                current_dict['fast_pass_info'] = wait_info['fastPass']
            if 'status' in wait_info:
                current_dict['status'] = wait_info['status']

            ride_wait_data[current_dict["ride_id"]] = current_dict

        return ride_wait_data
    def __init__(self, id=''):
        try:
            if id == '':
                raise ValueError(
                    'Attraction object expects an id value. Must be passed as string.\n Usage: Attraction(id)'
                )
            elif id != None and type(id) != str:
                raise TypeError('Attraction object expects a string argument.')

            self.__attraction_id = id

            authentication = get_header()
            s = requests.get(
                "https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/attractions/{}"
                .format(self.__attraction_id),
                headers=authentication)
            self.__data = json.loads(s.content)

            self.__attraction_name = self.__data['name'].replace(
                u"\u2019",
                "").replace(u"\u2013",
                            " ").replace(u"\u2122",
                                         "").replace(u"\u2022", " ")
            self.__attraction_name = self.__attraction_name.replace(
                u"\u00ae",
                "").replace(u"\u2014", "-").replace(u"\u00a1", "").replace(
                    u"\u00ee", "i").replace(u"\u25cf", " ")
            self.__attraction_name = self.__attraction_name.replace(
                u"\u00e9",
                "e").replace(u"\u00ad", "").replace(u"\u00a0", " ").replace(
                    u"\u00e8",
                    "e").replace(u"\u00eb",
                                 "e").replace(u"\u2026",
                                              "...").replace(u"\u00e4", "a")
            self.__attraction_name = self.__attraction_name.replace(
                u"\u2018",
                "").replace(u"\u00ed", "i").replace(u"\u201c", '').replace(
                    u"\u201d", '').replace("'", "").replace(u"\u2013",
                                                            ' ').strip()
            try:
                self.__coordinates = (self.__data["coordinates"]
                                      ["Guest Entrance"]["gps"]["latitude"],
                                      self.__data["coordinates"]
                                      ["Guest Entrance"]["gps"]["longitude"])
            except:
                self.__coordinates = ()

        except ValueError as e:
            print(e)
            sys.exit()
        except TypeError as e:
            print(e)
            sys.exit()
        except Exception as e:
            print(e)
            print(
                'That attraction or ID is not available. ID = {}\n Full list of possible attractions and their ID\'s can be found here: https://scaratozzolo.github.io/MouseTools/attractions.txt'
                .format(id))
            sys.exit()
Exemple #3
0
    def getAncestorLand(self):
        """
        Returns the Ancestor Land for the Entertainment
        """
        authentication = get_header()
        try:
            if self.checkRelatedLocations():
                s = requests.get(
                    self.__data['relatedLocations']['primaryLocations'][0]
                    ['links']['self']['href'],
                    headers=authentication)
                data = json.loads(s.content)

                return data['links']['ancestorLand']['title'].replace(
                    "-", " ").replace(u"\u2013", " ").replace("'", "")
            else:
                return None
        except:
            return None
Exemple #4
0
    def __init__(self, id=''):
        # This function works by querying the disney api to grab all information
        # related to this specific park as given by the id
        # the id' can be found in the parkIds.txt file
        try:
            if id == '':
                raise ValueError(
                    'Park object expects an ID. Must be passed as string as follows:\n Park(id)'
                )
            elif id != None and type(id) != str:
                raise TypeError(
                    'Park object expects a string input for the ID')

            self.__park_id = id
            try:
                authentication = get_header()
                s = requests.get(
                    "https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/theme-parks/{}"
                    .format(self.__park_id),
                    headers=authentication)
                self.__park_data = json.loads(s.content)

                if self.__park_data['errors'] != []:
                    s = requests.get(
                        "https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/water-parks/{}"
                        .format(self.__park_id),
                        headers=authentication)
                    self.__park_data = json.loads(s.content)

            except:
                pass

            self.__park_name = self.__park_data['name']
        except ValueError as e:
            print(e)
            sys.exit()
        except TypeError as e:
            print(e)
            sys.exit()
        except Exception as e:
            print(e)
            sys.exit()
    def __init__(self, id=''):
        """
        Constructor Function
        Gets all points of interest data available and stores various elements into variables.
        ID must be a string.
        """

        try:

            if id == '':
                raise ValueError(
                    'PointOfInterest object expects an id value. Must be passed as string.\n Usage: PointOfInterest(id)'
                )
            elif id != None and type(id) != str:
                raise TypeError(
                    'PointOfInterest object expects a string argument.')

            self.__id = id
            authentication = get_header()
            s = requests.get(
                "https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/points-of-interest/{}"
                .format(self.__id),
                headers=authentication)
            self.__data = json.loads(s.content)

            self.__point_of_interest_name = self.__data['name'].replace(
                u"\u2019",
                "'").replace(u"\u2013", "-").replace(u"\u2122", "").replace(
                    u"\u2022", "-").replace(u"\u00ae", "").replace(
                        u"\u2014", "-").replace(u"\u00a1", "").replace(
                            u"\u00ee", "i").replace(u"\u25cf", " ").replace(
                                u"\u00e9", "e").replace(u"\u00ad", "").replace(
                                    u"\u00a0",
                                    " ").replace(u"\u00e8", "e").replace(
                                        u"\u00eb",
                                        "e").replace(u"\u2026", "...").replace(
                                            u"\u00e4", "a").replace(
                                                u"\u2018", "'").replace(
                                                    u"\u00ed", "i").replace(
                                                        u"\u201c",
                                                        '"').replace(
                                                            u"\u201d",
                                                            '"').strip()
            self.__type = self.__data['type']
            try:
                self.__coordinates = (self.__data["coordinates"]
                                      ["Guest Entrance"]["gps"]["latitude"],
                                      self.__data["coordinates"]
                                      ["Guest Entrance"]["gps"]["longitude"])
            except:
                self.__coordinates = ()

        except ValueError as e:
            print(e)
            sys.exit()
        except TypeError as e:
            print(e)
            sys.exit()
        except Exception:
            print(
                'That point of interest or ID is not available. {} Full list of possible points of interest and their ID\'s can be found here: https://scaratozzolo.github.io/MouseTools/pointsofinterest.txt'
                .format(id))
            sys.exit()
Exemple #6
0
    def getTodayParkHours(self, date='Today'):
        if date == 'Today':
            DATE = datetime.today()

        else:
            DATE = date

        authentication = get_header()
        s = requests.get(
            "https://api.wdpro.disney.go.com/facility-service/schedules/{}?date={}-{}-{}"
            .format(self.__park_id, DATE.year,
                    self.__formatDate(str(DATE.month)),
                    self.__formatDate(str(DATE.day))),
            headers=authentication)

        schedule_data = json.loads(s.content)

        park_open = None
        park_close = None
        emh_open = None
        emh_close = None
        special_open = None
        special_close = None

        schedules = schedule_data['schedules']

        try:

            for item in schedules:
                if item['type'] == 'Operating':
                    park_open = datetime(DATE.year, DATE.month, DATE.day,
                                         int(item['startTime'][0:2]),
                                         int(item['startTime'][3:5]))
                    if int(item['endTime'][0:2]) >= 0 and int(
                            item['endTime'][0:2]) <= 7:
                        DATETEMP = DATE + timedelta(days=1)
                        park_close = datetime(DATETEMP.year, DATETEMP.month,
                                              DATETEMP.day,
                                              int(item['endTime'][0:2]),
                                              int(item['endTime'][3:5]))
                    else:
                        park_close = datetime(DATE.year, DATE.month, DATE.day,
                                              int(item['endTime'][0:2]),
                                              int(item['endTime'][3:5]))

                if item['type'] == 'Extra Magic Hours':
                    emh_open = datetime(DATE.year, DATE.month, DATE.day,
                                        int(item['startTime'][0:2]),
                                        int(item['startTime'][3:5]))
                    if int(item['endTime'][0:2]) >= 0 and int(
                            item['endTime'][0:2]) <= 7:
                        DATETEMP = DATE + timedelta(days=1)
                        emh_close = datetime(DATETEMP.year, DATETEMP.month,
                                             DATETEMP.day,
                                             int(item['endTime'][0:2]),
                                             int(item['endTime'][3:5]))
                    else:
                        emh_close = datetime(DATE.year, DATE.month, DATE.day,
                                             int(item['endTime'][0:2]),
                                             int(item['endTime'][3:5]))

                if item['type'] == 'Special Ticketed Event':
                    special_open = datetime(DATE.year, DATE.month, DATE.day,
                                            int(item['startTime'][0:2]),
                                            int(item['startTime'][3:5]))
                    if int(item['endTime'][0:2]) >= 0 and int(
                            item['endTime'][0:2]) <= 7:
                        DATETEMP = DATE + timedelta(days=1)
                        special_close = datetime(DATETEMP.year, DATETEMP.month,
                                                 DATETEMP.day,
                                                 int(item['endTime'][0:2]),
                                                 int(item['endTime'][3:5]))
                    else:
                        special_close = datetime(DATE.year, DATE.month,
                                                 DATE.day,
                                                 int(item['endTime'][0:2]),
                                                 int(item['endTime'][3:5]))

        except KeyError:
            pass

        return {
            'park_open': park_open,
            'park_close': park_close,
            'emh_open': emh_open,
            'emh_close': emh_close,
            'special_open': special_open,
            'special_close': special_close
        }