urllib2 error

asit lipun4u at gmail.com
Wed Nov 17 06:48:39 EST 2010


I have this piece of code

import urllib2

proc_url = 'http://www.nse-india.com/content/historical/EQUITIES/2001/
JAN/cm01JAN2001bhav.csv.zip'
print 'processing....', proc_url
req = urllib2.Request(proc_url)
res = urllib2.urlopen(req)

when i run this...following error comes

Traceback (most recent call last):
  File "C:/Python26/reqnse.py", line 92, in <module>
    res = urllib2.urlopen(req)
  File "C:\Python26\lib\urllib2.py", line 124, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python26\lib\urllib2.py", line 395, in open
    response = meth(req, response)
  File "C:\Python26\lib\urllib2.py", line 508, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python26\lib\urllib2.py", line 433, in error
    return self._call_chain(*args)
  File "C:\Python26\lib\urllib2.py", line 367, in _call_chain
    result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 516, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden

would anyone help me why ??



More information about the Python-list mailing list