bri-bri/yosemite-camping

'SEARCH_PATH' is not defined

davidliu1978 opened this issue · 4 comments

Great work thank you I think I almost get it running except this error below.can someone help?

Traceback (most recent call last):
File "campsites.py", line 133, in
sites = findCampSites(arg_dict)
File "campsites.py", line 67, in findCampSites
content_raw = sendRequest(payload)
File "campsites.py", line 118, in sendRequest
"ERROR, %d code received from %s".format(resp.status_code, BASE_URL + SEARCH_PATH))
NameError: name 'SEARCH_PATH' is not defined

'SEARCH_PATH' is not defined in the campsites.py file, which is causing the error. In addition to this, it seems like there's an issue with how "format" is being used in the exception. To clean this up and make the exception return properly, your line 118 could be changed to something like:
raise Exception("failedRequest","ERROR, %d code received from %s" % (resp.status_code, BASE_URL + UNIF_SEARCH))

However, the exception reporting isn't the biggest problem here. The problem is that the exception is being triggered at all. If you make the change noted above, you'll see that resp.status_code is giving a 403 code instead of the desired 200. I believe this means that access is being forbidden by the server, maybe because the session spoofing that the script is set up to do is no longer working properly?

Getting the whole thing back up and working is a little beyond my knowledge, but if anybody has managed to do it, more help on this would be very much appreciated.

Does anyone have this working... kinda new to python so trying diff things

Not working for me either. Even if SEARCH_PATH is defined, you'll hit another issue. I believe the URL https://www.recreation.gov/unifSearch.do the script uses is not valid anymore. Seems the website got refactored.