0

I am trying to download precipitation data from an ftp server. The code that i am using is, but am still getting errors. Thanks

import urllib2
urlretrieve("http://ftp.cpc.ncep.noaa.gov/fews/fewsdata/africa/arc2/geotiff/", "folder link")
Paulo
  • 41
  • 1
  • 5

2 Answers2

0

I personally recommend using pycurl for this. have you tried using the ftp protocol?:

urlretrieve("ftp://ftp.cpc.ncep.noaa.gov/fews/fewsdata/africa/arc2/geotiff/", "folder link")
bmbigbang
  • 1,318
  • 1
  • 10
  • 15
0

Seeing the URL, it seems you are using http protocol. If you want ftp, you may need to call it like this:

from urllib import urlretrieve
urlretrieve("ftp://ftp.cpc.ncep.noaa.gov/fews/fewsdata/africa/arc2/geotiff/", "folder link")

(Also, be careful of your package. You're doing from urllib and you're calling urlretrieve. It must be urllib.urlretrieve(...) in your case)

See this stackoverflow thread, it may help you.

Also I do not think that the second argument of urlretrieve is a folder link. It is a file name.

Community
  • 1
  • 1