I'm trying to create a method that allows me to download files from a server (using HTTP) only if the file is newest than the version already downloaded to my computer.
I found a way to get the last time that the file was modified on the server (at least the last time that the server thinks that it was modified):
u = urllib2.urlopen(url)
meta = u.info()
print("Last Modified: " + str(meta.getheaders("Last-Modified")))
The problem now is how to use this information to compare with the files that I already have on my computer and see if that version located on the server is newer than the version saved on my computer.
I tried to use python-wget
library; however, it didn't help. It is downloading everything and not even is overwriting the files (it is creating new ones), so I realized that that library doesn't check the timestamp.
What is the best way to solve that?