You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error 403 - Forbidden for url: https://www.craigslist.org/about/sites #105
I have used your code before (early 2020), but now I'm getting the error below when trying to import CraigslistHousing, using "from craigslist import CraigslistHousing":
Seems like this works on my end. Did you upgrade python-craigslist to the latest version? I have a feeling this issue might be agnostic of package upgrade, but it doesn't hurt..
Ah, this looks to be a problem with the requests library in your environment, not python-craigslist, per se.
I'm guessing the same exception would be thrown if you executed this:
Interesting. Seems like Craigslist is blocking requests coming from your IP (or Google's Colab IPs). I'm guessing the IP hit a max number of requests per day/hour/minute.
Do you mind running the code suggested by @irahorecka but setting a User-Agent like you did with urllib:
It seems that Google's Colab IPs is blocked by Craigslist... I successfully ran the code in a local jupyter notebook and it worked like a charm.
I tried the code you suggested in Colab and continued to get the 403 response... However I receive the right page if I use the code below, not sure if somehow the code could be adapted.
Just a heads up, I've got the exact same issue. I've been running my code for more than a year and this just happened this week. So, something must have changed on the craigslist side? I'll have to dig into the code. I can cut and paste the url into a browser and it works fine. Just wanted to let you know of another user with the same issues.
I tried it on a couple of computers, so I don't think it's IP related. Guess how the servers are seeing the 'requests' library versus a regular library.
Hey everyone! Sorry for the inactivity. I've released a new version (1.1.1) adding a User-Agent to requests.get. Hopefully that will solve the issue, please report back if it does or doesn't. If it doesn't I'll have to change libraries to urllib.
Thanks!
+1 Having the same behavior - 403s on /search paths through just a general requests.get() call so the library/class is also not functioning.
Also note I tried taking the headers object from the cURL to /search which loads in a regular browser and used that for the requests call which they also blocked.
I used a selenium driver I had with some mods I've used in the past and I was able to load /search just fine so I don't suspect they are doing something super sophisticated to block the request.
Okay I've dug into it a bit more - I don't think this has anything do to with user agents or anything they are blocking like that. I recommend upgrading both the requests and urlib3 library pip install urllib3 --upgradepip install requests --upgrade. Once I did that things started working again. So not sure the actual issue - as older versions of those libraries were working - but with the updates it looks fine to me.
After I did that I tested the request function (which is effectively requests.get()) works:
Thanks @KeeonTabrizi! That's a very good point.
I've updated the requirements to include some minimum version for requirements (requests and beautifulsoup4).
Can anyone having issues try updating their library (pip install python-craigslist --upgrade) and let me know if this fixed the issue.
Thanks again!
Hey guys.
I am not a power user, but I have found that the latest *idna* version is
incompatible with *requests*. If you installed the latest *idna* then just
run *requests* upgrade and it will revert the *idna* version. I have no
clue that it could be your troubles, but it could be a factor.
Hope this helps.
Le mar. 23 févr. 2021 à 13:15, Julio M. Alegria <notifications@github.com>
a écrit :
Hey y'all, thanks so much for taking the time to fix this! So, it could just be how my packages were managed, but, when I performed (pip install python-craigslist --upgrade) it updated requests but not urllib3. I guess urllib3 is used by requests. So, it did not work with just upgrading python-craigslist. But, after updating both request and urllib3 to the latest, back up and running! Maybe consider adding urllib to the requirements? Thanks again!!
Hey y'all, thanks so much for taking the time to fix this! So, it could just be how my packages were managed, but, when I performed (pip install python-craigslist --upgrade) it updated requests but not urllib3. I guess urllib3 is used by requests. So, it did not work with just upgrading python-craigslist. But, after updating both request and urllib3 to the latest, back up and running! Maybe consider adding urllib to the requirements? Thanks again!!
@cwittwer, @jraVette, @usctzen, @KeeonTabrizi, @luisandrecunha If you guys are interested in a new Craigslist API format, check out pycraigslist.
I enjoy python-craigslist, but there were some features I wanted to implement immediately. Some additional features are in the works.
Ira,
Just gave it a quick try and I am getting an error. The script finds the
forsale.mca but does not recognize the forsale.mcy
mca is motorcycle all and mcy is motorcycles by owner.
*Traceback (most recent call last): File
"C:/Users/mgpd/PycharmProjects/molivo/py_clist.py", line 3, in <module>
print(pycraigslist.forsale.mcy.get_filters())AttributeError: type object
'forsale' has no attribute 'mcy'*
Marc @usctzen
Le mar. 30 mars 2021 à 18:42, Ira Horecka ***@***.***> a
écrit :
Hey everyone! Sorry for the delay, I've updated the requirements in 88a6b73 and pushed a new version in PyPI. Could anyone confirm if the issue is fixed with this?
Thanks for all the patience!
Activity
irahorecka commentedon Jan 5, 2021
Seems like this works on my end. Did you upgrade
python-craigslistto the latest version? I have a feeling this issue might be agnostic of package upgrade, but it doesn't hurt..luisandrecunha commentedon Jan 5, 2021
Yep, I did the upgrade and continue to have the same issue. Using v1.1.0 and python 3.6, I'm using Google's Colab notebooks.
irahorecka commentedon Jan 5, 2021
Ah, this looks to be a problem with the
requestslibrary in your environment, notpython-craigslist, per se.I'm guessing the same exception would be thrown if you executed this:
luisandrecunha commentedon Jan 5, 2021
You are completely right, I also tried in a new colab and got "<Response [403]>"
If I run the code below I get a successful response and the page code. I believe it's related with the web scraping issue in this page.
juliomalegria commentedon Jan 7, 2021
Thanks for reporting @luisandrecunha.
Interesting. Seems like Craigslist is blocking requests coming from your IP (or Google's Colab IPs). I'm guessing the IP hit a max number of requests per day/hour/minute.
Do you mind running the code suggested by @irahorecka but setting a User-Agent like you did with
urllib:If this works fine, I'll add a default
User-Agentto all requests to prevent this from happening in the future.Thanks!
luisandrecunha commentedon Jan 8, 2021
Hi @juliomalegria ,
It seems that Google's Colab IPs is blocked by Craigslist... I successfully ran the code in a local jupyter notebook and it worked like a charm.
I tried the code you suggested in Colab and continued to get the 403 response... However I receive the right page if I use the code below, not sure if somehow the code could be adapted.
Thank you again,
jraVette commentedon Feb 18, 2021
Just a heads up, I've got the exact same issue. I've been running my code for more than a year and this just happened this week. So, something must have changed on the craigslist side? I'll have to dig into the code. I can cut and paste the url into a browser and it works fine. Just wanted to let you know of another user with the same issues.
I tried it on a couple of computers, so I don't think it's IP related. Guess how the servers are seeing the 'requests' library versus a regular library.
Thanks!
juliomalegria commentedon Feb 19, 2021
Hey everyone! Sorry for the inactivity. I've released a new version (
1.1.1) adding aUser-Agenttorequests.get. Hopefully that will solve the issue, please report back if it does or doesn't. If it doesn't I'll have to change libraries tourllib.Thanks!
cwittwer commentedon Feb 20, 2021
I am still getting the 403 error with the updated utils.py.
KeeonTabrizi commentedon Feb 21, 2021
+1 Having the same behavior - 403s on
/searchpaths through just a generalrequests.get()call so the library/class is also not functioning.Also note I tried taking the headers object from the cURL to
/searchwhich loads in a regular browser and used that for the requests call which they also blocked.I used a selenium driver I had with some mods I've used in the past and I was able to load
/searchjust fine so I don't suspect they are doing something super sophisticated to block the request.KeeonTabrizi commentedon Feb 22, 2021
Okay I've dug into it a bit more - I don't think this has anything do to with user agents or anything they are blocking like that. I recommend upgrading both the
requestsandurlib3librarypip install urllib3 --upgradepip install requests --upgrade. Once I did that things started working again. So not sure the actual issue - as older versions of those libraries were working - but with the updates it looks fine to me.After I did that I tested the request function (which is effectively
requests.get()) works:juliomalegria commentedon Feb 23, 2021
Thanks @KeeonTabrizi! That's a very good point.
I've updated the requirements to include some minimum version for requirements (requests and beautifulsoup4).
Can anyone having issues try updating their library (
pip install python-craigslist --upgrade) and let me know if this fixed the issue.Thanks again!
usctzen commentedon Feb 23, 2021
jraVette commentedon Feb 23, 2021
Hey y'all, thanks so much for taking the time to fix this! So, it could just be how my packages were managed, but, when I performed (
pip install python-craigslist --upgrade) it updatedrequestsbut noturllib3. I guessurllib3is used byrequests. So, it did not work with just upgradingpython-craigslist. But, after updating bothrequestandurllib3to the latest, back up and running! Maybe consider addingurllibto the requirements? Thanks again!!These versions are what got my code working:
PS. great module, it's helped me get some great deals on Craiglist!
cwittwer commentedon Mar 11, 2021
+1 this fixed everything. Good catch!
irahorecka commentedon Mar 30, 2021
@cwittwer, @jraVette, @usctzen, @KeeonTabrizi, @luisandrecunha If you guys are interested in a new Craigslist API format, check out pycraigslist.
I enjoy python-craigslist, but there were some features I wanted to implement immediately. Some additional features are in the works.
usctzen commentedon Mar 30, 2021
usctzen commentedon Mar 30, 2021
irahorecka commentedon Mar 30, 2021
Hey @usctzen, I always appreciate your feedback. Could you post the same issue in pycraigslist issues? I’ll address it there :)
usctzen commentedon Mar 30, 2021
juliomalegria commentedon Apr 6, 2021
Hey everyone! Sorry for the delay, I've updated the requirements in 88a6b73 and pushed a new version in PyPI. Could anyone confirm if the issue is fixed with this?
Thanks for all the patience!
Agwebberley commentedon Nov 21, 2022
I am still having this issue