urllib.error.HTTPError: HTTP Error 403: Forbidden

Discussion in 'Python' started by iMath, Dec 24, 2012.

  1. iMath

    iMath Guest

    >>> 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')
    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 ?
    iMath, Dec 24, 2012
    #1
    1. Advertising

  2. 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
    Steven D'Aprano, Dec 24, 2012
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Hunt
    Replies:
    4
    Views:
    11,278
    gullsinn
    Oct 4, 2009
  2. Raghu Raman

    HTTP Error 403 - Forbidden Error -asp.net

    Raghu Raman, Apr 8, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    664
    Raghu Raman
    Apr 8, 2009
  3. Devasena Rai
    Replies:
    2
    Views:
    758
    Mr. Arnold
    Apr 15, 2009
  4. willem joubert

    Error 403-Error 403-Error 403

    willem joubert, Feb 8, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    158
    Bruce Johnson [C# MVP]
    Feb 8, 2005
  5. Mark J. McGinty

    IIS HTTP 403.1 Forbidden: Execute Access Forbidden

    Mark J. McGinty, Dec 9, 2005, in forum: ASP General
    Replies:
    2
    Views:
    340
    Kyle Peterson
    Dec 9, 2005
Loading...

Share This Page