title: Urllib HTTP Error 403
body: <p>I've searched through the forums to try and figure out why the following code was not working:</p>
  
  <pre><code>import nltk, re, pprint
  from urllib import request
  url = "http://www.gutenberg.org/files/2554/2554.txt"
  response = request.urlopen(url)
  raw = response.read().decode('utf8')
  print(raw[:75])
  </code></pre>
  
  <p>But have thus far been unsuccessful in resolving things. Here are some similar solutions I tried to implement to no avail:
  <a href="https://stackoverflow.com/questions/22877619/python3-urllib-error-httperror-http-error-403-forbidden">Forum 1,</a>
  <a href="https://stackoverflow.com/questions/16627227/http-error-403-in-python-3-web-scraping">Forum 2</a></p>
  
  <p>The error I get is:</p>
  
  <pre><code> File "C:\Python33\lib\urllib\request.py", line 163, in urlopen
  return opener.open(url, data, timeout)
   File "C:\Python33\lib\urllib\request.py", line 472, in open
  response = meth(req, response)
   File "C:\Python33\lib\urllib\request.py", line 582, in http_response
  'http', request, response, code, msg, hdrs)
   File "C:\Python33\lib\urllib\request.py", line 510, in error
  return self._call_chain(*args)
   File "C:\Python33\lib\urllib\request.py", line 444, in _call_chain
  result = func(*args)
   File "C:\Python33\lib\urllib\request.py", line 590, in http_error_default
  raise HTTPError(req.full_url, code, msg, hdrs, fp)
  urllib.error.HTTPError: HTTP Error 403: Forbidden
  </code></pre>
  
  <p>Any help would be greatly appreciated</p>