Skip to content

Commit

Permalink
Updating Search Logic For Entity
Browse files Browse the repository at this point in the history
Don't hardcode the entity type and instead use the one returned from the
API.
  • Loading branch information
ChuckMac committed Sep 20, 2022
1 parent 198341e commit 2090e5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion adrfinder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from flask_login import login_required
from adrfinder.restaurants import Restaurants

__version__ = '0.2'
__version__ = '0.2.1'

datastore = None

Expand Down
11 changes: 6 additions & 5 deletions adrfinder/fetch_site_status.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import time
import urllib3
import urllib.parse
import json
import requests
import time
import http.client
from datetime import datetime, timedelta

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

Expand Down Expand Up @@ -55,15 +51,20 @@ def run(self, uuid):
party_size = self.datastore.get_val(uuid, 'party_size')
search_time = urllib.parse.quote(self.datastore.get_val(uuid, 'search_time'))

entity = restaurant[restaurant.index('entityType'):]

endpoint = "/finder/api/v1/explorer-service/dining-availability-list/false/wdw/80007798;" + entity + "/" + date + "/" + party_size + "/?searchTime=" + search_time

try:
self.connection.request("GET", "/finder/api/v1/explorer-service/dining-availability-list/false/wdw/80007798;entityType=destination/" + date + "/" + party_size + "/?searchTime=" + search_time, headers=self.headers)
self.connection.request("GET", endpoint, headers=self.headers)
except Exception as e:
print(">> Request failed, Unable to get reservation data: {}".format(e))
raise SystemExit(e)

response = self.connection.getresponse()
if response.status != 200:
print(">> Request failed, Non-200 received getting reservation data: {}".format(response.status))
print(">> Request url: https://disneyworld.disney.go.com{}".format(endpoint))
raise SystemExit(response.status)

data = response.read()
Expand Down

0 comments on commit 2090e5b

Please sign in to comment.