urllib.error.HTTPError: HTTP Error 403: Forbidden

I

iMath

import urllib.requestTraceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
response = urllib.request.urlopen('http://en.wikipedia.org/wiki/Internet_media_type')
File "C:\Python32\lib\urllib\request.py", line 138, in urlopen
return opener.open(url, data, timeout)
File "C:\Python32\lib\urllib\request.py", line 375, in open
response = meth(req, response)
File "C:\Python32\lib\urllib\request.py", line 487, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python32\lib\urllib\request.py", line 413, in error
return self._call_chain(*args)
File "C:\Python32\lib\urllib\request.py", line 347, in _call_chain
result = func(*args)
File "C:\Python32\lib\urllib\request.py", line 495, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden


why this url generate error ?
 
S

Steven D'Aprano

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top