I'm trying to download data using commands below.
import urllib
url = 'http://www.nse-india.com/content/historical/EQUITIES/2002/MAR/cm01MAR2002bhav.csv.zip'
urllib.urlretrieve(url, 'myzip')
Wh开发者_如何学编程at I see in the file generated file my.zip is,
You don't have permission to access "http://www.nse-india.com/content/historical/EQUITIES/2002/MAR/cm01MAR2002bhav.csv.zip" on this server.<P>
Reference #18.7d427b5c.1311889977.25329891
But I'm able to download the file from the website without any problem. What is the reason for this?
You may need to use urllib2
and set the user-agent
header to something it recognizes. It might just be blocking anything that doesn't appear to be a normal user.
精彩评论