juftin / camply

camply, the campsite finder ⛺️ - a tool to find campsites at sold out campgrounds through sites like recreation.gov
https://juftin.com/camply/
MIT License
481 stars 93 forks source link

Going-to-camp provider campground listing not working #237

Closed cpwang96 closed 1 year ago

cpwang96 commented 1 year ago

Describe the bug Receiving bad data from GoingtoCamp API

Original Camply Command (with --debug)

camply campgrounds --debug --provider goingtocamp --rec-area 3

Expected behavior < A clear and concise description of what you expected to happen. >

Console Output (with --debug)

chuping@Chupings-Air ~ % camply campgrounds --debug --provider goingtocamp --rec-area 3
[2023-04-04 11:46:58] CAMPLY   camply, the campsite finder ⛺️                                                                                                                                               
[2023-04-04 11:46:58] INFO     Using Camply Provider: "GoingToCamp"                                                                                                                                         
[2023-04-04 11:46:58] DEBUG    Setting up camply debugging                                                                                                                                                  
[2023-04-04 11:46:58] DEBUG    Camply Version: 0.16.0                                                                                                                                                       
[2023-04-04 11:46:58] DEBUG    Python Version: 3.9.6                                                                                                                                                        
[2023-04-04 11:46:58] DEBUG    Platform: darwin                                                                                                                                                             
[2023-04-04 11:46:58] INFO     Retrieving Facility Information for Recreation Area ID: `3`.                                                                                                                 
[2023-04-04 11:46:58] DEBUG    Starting new HTTPS connection (1): washington.goingtocamp.com:443                                                                                                            
[2023-04-04 11:46:58] DEBUG    https://washington.goingtocamp.com:443 "GET /api/resourcelocation/rootmaps HTTP/1.1" 404 0                                                                                   
[2023-04-04 11:46:58] ERROR    Receiving bad data from GoingToCamp API: status_code:                                                                                                                        
[2023-04-04 11:46:58] CAMPLY   Exiting camply 👋                                                                                                                                                            
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/chuping/Library/Python/3.9/bin/camply:8 in <module>                                       │
│                                                                                                  │
│   5 from camply.cli import cli                                                                   │
│   6 if __name__ == '__main__':                                                                   │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(cli())                                                                          │
│   9                                                                                              │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ cli = <function cli at 0x1289f98b0>                                                          │ │
│ │  re = <module 're' from                                                                      │ │
│ │       '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.… │ │
│ │ sys = <module 'sys' (built-in)>                                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/camply/cli.py:750 in cli              │
│                                                                                                  │
│   747 │   Camply Command Line Utility Wrapper                                                    │
│   748 │   """                                                                                    │
│   749 │   try:                                                                                   │
│ ❱ 750 │   │   camply_command_line()                                                              │
│   751 │   except KeyboardInterrupt:                                                              │
│   752 │   │   logger.debug("Handling Exit Request")                                              │
│   753 │   finally:                                                                               │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/click/core.py:1130 in __call__        │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/rich_click/rich_group.py:21 in main   │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/click/core.py:1055 in main            │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/click/core.py:1657 in invoke          │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/click/core.py:1404 in invoke          │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/click/core.py:760 in invoke           │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/click/decorators.py:38 in new_func    │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/camply/cli.py:311 in campgrounds      │
│                                                                                                  │
│   308 │   params = {}                                                                            │
│   309 │   if state is not None:                                                                  │
│   310 │   │   params.update({"state": state})                                                    │
│ ❱ 311 │   camp_finder.find_campgrounds(                                                          │
│   312 │   │   search_string=search,                                                              │
│   313 │   │   rec_area_id=make_list(rec_area, coerce=int),                                       │
│   314 │   │   campground_id=make_list(campground, coerce=int),                                   │
│                                                                                                  │
│ ╭──────────────────────────────────────── locals ────────────────────────────────────────╮       │
│ │           camp_finder = <GoingToCampProvider>                                          │       │
│ │            campground = ()                                                             │       │
│ │              campsite = ()                                                             │       │
│ │               context = CamplyContext(debug=True, provider=None)                       │       │
│ │                 debug = True                                                           │       │
│ │                params = {}                                                             │       │
│ │              provider = 'GoingToCamp'                                                  │       │
│ │              rec_area = ('3',)                                                         │       │
│ │                search = None                                                           │       │
│ │ search_provider_class = <class 'camply.search.search_going_to_camp.SearchGoingToCamp'> │       │
│ │                 state = None                                                           │       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────╯       │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/camply/providers/going_to_camp/going_ │
│ to_camp_provider.py:208 in find_campgrounds                                                      │
│                                                                                                  │
│   205 │   │   │   )                                                                              │
│   206 │   │   │   sys.exit(1)                                                                    │
│   207 │   │                                                                                      │
│ ❱ 208 │   │   return self.find_facilities_per_recreation_area(                                   │
│   209 │   │   │   rec_area_id=rec_area_id,                                                       │
│   210 │   │   │   campground_id=campground_id,                                                   │
│   211 │   │   │   searching_string=search_string,                                                │
│                                                                                                  │
│ ╭─────────────── locals ────────────────╮                                                        │
│ │ campground_id = []                    │                                                        │
│ │   campsite_id = []                    │                                                        │
│ │        kwargs = {}                    │                                                        │
│ │   rec_area_id = ['3']                 │                                                        │
│ │ search_string = None                  │                                                        │
│ │          self = <GoingToCampProvider> │                                                        │
│ ╰───────────────────────────────────────╯                                                        │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/camply/providers/going_to_camp/going_ │
│ to_camp_provider.py:355 in find_facilities_per_recreation_area                                   │
│                                                                                                  │
│   352 │   │   │   sys.exit(1)                                                                    │
│   353 │   │                                                                                      │
│   354 │   │   self.campground_details = {}                                                       │
│ ❱ 355 │   │   api_response = self._api_request(rec_area_id, "LIST_CAMPGROUNDS")                  │
│   356 │   │                                                                                      │
│   357 │   │   filtered_facilities = self._filter_facilities_responses(                           │
│   358 │   │   │   rec_area_id, facilities=api_response                                           │
│                                                                                                  │
│ ╭─────────────────────────────── locals ───────────────────────────────╮                         │
│ │             _ = 'camping.bcparks.ca'                                 │                         │
│ │ campground_id = []                                                   │                         │
│ │        kwargs = {'searching_string': None}                           │                         │
│ │            ra = RecreationArea(                                      │                         │
│ │                 │   recreation_area='BC Parks',                      │                         │
│ │                 │   recreation_area_id=12,                           │                         │
│ │                 │   recreation_area_location='British Columbia, CA', │                         │
│ │                 │   coordinates=None,                                │                         │
│ │                 │   description=None                                 │                         │
│ │                 )                                                    │                         │
│ │      rec_area = RecreationArea(                                      │                         │
│ │                 │   recreation_area='Washington State Parks',        │                         │
│ │                 │   recreation_area_id=3,                            │                         │
│ │                 │   recreation_area_location='Washington, USA',      │                         │
│ │                 │   coordinates=None,                                │                         │
│ │                 │   description=None                                 │                         │
│ │                 )                                                    │                         │
│ │   rec_area_id = '3'                                                  │                         │
│ │ search_string = None                                                 │                         │
│ │          self = <GoingToCampProvider>                                │                         │
│ ╰──────────────────────────────────────────────────────────────────────╯                         │
│                                                                                                  │
│ /Users/chuping/Library/Python/3.9/lib/python/site-packages/camply/providers/going_to_camp/going_ │
│ to_camp_provider.py:418 in _api_request                                                          │
│                                                                                                  │
│   415 │   │   │   error_message = "Receiving bad data from GoingToCamp API: status_code: "       │
│   416 │   │   │   f"{response.status_code}: {response.text}"                                     │
│   417 │   │   │   logger.error(error_message)                                                    │
│ ❱ 418 │   │   │   raise ConnectionError(error_message)                                           │
│   419 │   │                                                                                      │
│   420 │   │   return json.loads(response.content)                                                │
│   421                                                                                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │      endpoint = 'https://{}/api/resourcelocation/rootmaps'                                   │ │
│ │ endpoint_name = 'LIST_CAMPGROUNDS'                                                           │ │
│ │ error_message = 'Receiving bad data from GoingToCamp API: status_code: '                     │ │
│ │      hostname = 'washington.goingtocamp.com'                                                 │ │
│ │        params = {}                                                                           │ │
│ │   rec_area_id = '3'                                                                          │ │
│ │      response = <Response [404]>                                                             │ │
│ │          self = <GoingToCampProvider>                                                        │ │
│ │           url = 'https://washington.goingtocamp.com/api/resourcelocation/rootmaps'           │ │
│ │    user_agent = {                                                                            │ │
│ │                 │   'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML,   │ │
│ │                 like Gecko) Chrome/12.0.'+19                                                 │ │
│ │                 }                                                                            │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ConnectionError: Receiving bad data from GoingToCamp API: status_code: 

Additional context

< Add any other context about the problem here. >

juftin commented 1 year ago

@acaloiaro FYI. https://washington.goingtocamp.com/api/resourcelocation/rootmaps is giving a 404 response

acaloiaro commented 1 year ago

I'm getting errors trying to create a booking in the browser as well. It appears as though they're having an outage.

E.g. this URL is generated by their web application, and I see a 404 in the javascript console of my browser during page load: https://washington.goingtocamp.com/create-booking/results?resourceLocationId=-2147483593&mapId=-2147483561&searchTabGroupId=0&bookingCategoryId=0&startDate=2023-05-01&endDate=2023-05-08&nights=7&isReserving=true&equipmentId=-32768&subEquipmentId=-32764&partySize=1&filterData=%7B%22-32759%22:%22%5B%5B1%5D,0,0,0%5D%22,%22-32708%22:%22%5B%5B1%5D,0,0,0%5D%22%7D&searchTime=2023-04-04T12:06:18.134

After selecting a site and clicking "Reserve" also results in an infinite spinner with a "Securing your site" message.

acaloiaro commented 1 year ago

GTC actually did remove the rootmaps endpoint. I refactored to use a different endpoint that seems to be doing the trick, but I'll need to do a bit more testing before I'm confident.

acaloiaro commented 1 year ago

@cpwang96 There's a fix for this that should be ready soon, once I get some input from @juftin on the pull request.

juftin commented 1 year ago

:tada: This issue has been resolved in version 0.16.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: