2017-05-04 86 views
0

我不得不從網站http://www.kase.kz/ru/marketvaluation半徑誤差HTTP狀態爲「503服務暫時不可用」

這個問題基本上是從this話題起源下載幾個zip文件。具有不解決這個問題到現在爲止,我嘗試以下方法:

for (i in 1:length(data[,2])){ 
    URL = data[i, 2] 
    dir = basename(URL) 
    download.file(URL, dir) 
    unzip(dir) 
    TXT <- list.files(pattern = "*.TXT") 
    zip <- list.files(pattern = "*.zip") 
    file.remove(TXT, zip) 
} 

現在我面臨的另一個問題 - 第四或第五審判後R是給我:

trying URL 'http://www.kase.kz/files/market_valuation/ru/2017/val170403170409.zip' 
Error in download.file(URL, dir) : 
    cannot open URL 'http://www.kase.kz/files/market_valuation/ru/2017/val170403170409.zip' 
In addition: Warning message: 
In download.file(URL, dir) : 
    cannot open URL 'http://www.kase.kz/files/market_valuation/ru/2017/val170403170409.zip': HTTP status was '503 Service Temporarily Unavailable' 

我不知道這是爲什麼發生。我將不勝感激任何建議/解決方案。

回答

1

稀釋,這是一塊蛋糕:

for (i in 1:length(data[,2])){ 
    URL = data[i, 2] 
    dir = basename(URL) 
    download.file(URL, dir) 
    unzip(dir) 
    TXT <- list.files(pattern = "*.TXT") 
    zip <- list.files(pattern = "*.zip") 
    file.remove(TXT, zip) 
    Sys.sleep(sample(10, 1)) 
} 
相關問題