1

I try to read this url - http://malc0de.com/bl/BOOT in Python

import urllib2
threats = urllib2.urlopen("http://malc0de.com/bl/BOOT")

But I got this error:

Traceback (most recent call last):
  File "C:\Android\android_workspace\pro2\test.py", line 2, in <module>
    threats = urllib2.urlopen("http://malc0de.com/bl/BOOT")
  File "C:\Python27\lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 437, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

What can I do to fix it?

shira stenmetz
  • 297
  • 1
  • 6
  • 11

1 Answers1

1

This is a HTTP error unrelated to python or urllib. It says that, for some reason, you are not allowed to view this particular page.

It seems to me that the site owner filters access by bots/crawlers, because I can open it in Firefox, but not via urllib. It might filter based on user agent, which may be changed, see Changing user agent on urllib2.urlopen, although this might be bad etiquette.