bri-bri / yosemite-camping

Simple script for scraping yosemite campgrounds!
109 stars 49 forks source link

'SEARCH_PATH' is not defined #4

Open davidliu1978 opened 5 years ago

davidliu1978 commented 5 years ago

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

000011111111 commented 5 years ago

Are you available to get some of the basic test scripts working with the automation software?

On Sep 29, 2018 1:14 PM, "Dan" notifications@github.com wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bri-bri/yosemite-camping/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/ALYX3MM3ETeLXgqQh2a-7BOsyoX1n3m_ks5uf9S6gaJpZM4XAqxz .

stebrown commented 5 years ago

'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.

professorjedi commented 5 years ago

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

hajjat commented 3 years ago
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.