from six.moves.urllib.request import urlopen, urlretrieve, urlrequest
conn = urlopen('ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.dailyavgs/surface/lftx.sfc.2017.nc', timeout=20)
last_modified = conn.headers['last-modified']
Following How can I get the last-modified time with python3 urllib? I want to get last modification date of a file on a FTP server. However, with the code above, last-modified
is None
. Any suggestions? I want solution to work on both python 2 and python 3