urllib.error.HTTPError: HTTP Error 403: Forbidden
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Dec 23 20:29:14 EST 2012
On Sun, 23 Dec 2012 17:05:47 -0800, iMath wrote:
>>>> import urllib.request
>>>> response =
>>>> urllib.request.urlopen('http://en.wikipedia.org/wiki/
Internet_media_type')
> Traceback (most recent call last):
> File "<pyshell#1>", line 1, in <module>
> response =
> urllib.request.urlopen('http://en.wikipedia.org/wiki/
Internet_media_type')
[...]
> urllib.error.HTTPError: HTTP Error 403: Forbidden
>
>
> why this url generate error ?
Because you are in violation of Wikipedia's terms and services. Please do
not try to screen-scrape Wikipedia. Instead, use their API for accessing
pages.
http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot
--
Steven
More information about the Python-list
mailing list