On Wed, Nov 17, 2010 at 5:31 PM, Kushal Kumaran <kushal.kumaran+pyt...@gmail.com> wrote: > On Wed, Nov 17, 2010 at 5:18 PM, asit <lipu...@gmail.com> wrote: >> 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): >> <snipped detailed trace> >> HTTPError: HTTP Error 403: Forbidden >> > > The web server is probably trying to forbid downloads using automated > tools by examining the user agent header (downloading using wget also > fails, for example). You can work around that by setting the > User-Agent header to the same value as a browser that works. > > The urllib2 documentation covers how to set headers in requests. > > -- > regards, > kushal >
-- Regards, Asit Kumar Dhal TCS, Mumbai blog: http://asitdhal.blogspot.com/ Thanx...it worked -- http://mail.python.org/mailman/listinfo/python-list