Forums

urllib, why forbidden?

2013-08-17 01:35:18,726 - debug_logger - INFO - update_raw_data: http://lenta.ru/rss
Traceback (most recent call last):
  File "/home/kerniexvid/rss_dj/Wacorund/walk_sources.py", line 292, in <module>
    update_raw_data(date)
  File "/home/kerniexvid/rss_dj/Wacorund/walk_sources.py", line 46, in update_raw_data
    raw_data = urllib2.urlopen(source).read()
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 448, in error
return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

I suspect this is because you are not a paying user, and therefore only have access to whitelisted sites...

@rcs1000 is right, it's because you're trying access a site that's not on the whitelist from a free account. I see you switched from a Web Developer account to a free one back in July, and your last month on the paid plan ended a few days ago, so if it was working before then and recently stopped, that would be why.

kerniexvid: no offense, but I'm just impressed that you can read Lenta's RSS feed. Of course I'm impressed with all who are multi-lingual for that matter...☺

I'm facing the same kind of problem: each call to urllib.request.urlopen() raises a 403

File "/usr/lib/python3.4/urllib/request.py", line 579, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden

My webapp is trying to scrap a website called monavislerendgratuit.com

The flask app is working without raising any errors when I launch it in local from my computer and now I'm trying to host it on pythonanywhere. I was planning on taking a WebDev account anyway, but there is no way I can try my app with a free account?

Unfortunately not. But remember, we offer a 30-day no-questions-asked money-back guarantee. So if you upgrade to a web dev account and you change your mind within 30 days, you can just email us and we'll refund everything.