Using this to get teh zip file from NSE
myURL = paste("httpS://www.nseindia.com/content/historical/EQUITIES/", as.character(myDate, "%Y"), "/", toupper(as.character(myDate, "%b")), "/", downloadfilename, ".zip", sep = "")
GET(myURL, user_agent("Mozilla/5.0"), write_disk(paste(downloadfilename,".zip",sep="")))
and the response is:
Response [httpS://www.nseindia.com/content/historical/EQUITIES/2019/JAN/cm01JAN2019bhav.csv.zip]
Date: 2019-01-03 14:24
Status: 403
Content-Type: text/html
Size: 354 B
<ON DISK> D:\eq\cm01JAN2019bhav.csv.zip
size = 1 Kb and the zip cannot be opened after downloading. the zip is downloaded via a script
Conclusion - NSE prevents us from accessing the zip file via downloader. so the solution is to download the zip and transform it in offline mode
myURL = paste("httpS://www.nseindia.com/content/historical/EQUITIES/", as.character(myDate, "%Y"), "/", toupper(as.character(myDate, "%b")), "/", downloadfilename, ".zip", sep = "")
GET(myURL, user_agent("Mozilla/5.0"), write_disk(paste(downloadfilename,".zip",sep="")))
and the response is:
Response [httpS://www.nseindia.com/content/historical/EQUITIES/2019/JAN/cm01JAN2019bhav.csv.zip]
Date: 2019-01-03 14:24
Status: 403
Content-Type: text/html
Size: 354 B
<ON DISK> D:\eq\cm01JAN2019bhav.csv.zip
size = 1 Kb and the zip cannot be opened after downloading. the zip is downloaded via a script
Conclusion - NSE prevents us from accessing the zip file via downloader. so the solution is to download the zip and transform it in offline mode
Last edited: