Getting file timestamp from url

mhearne808[insert-at-sign-here]gmail[insert-dot-here]com mhearne808 at gmail.com
Fri Nov 16 20:34:13 EST 2007


Is is possible to get the timestamp of a file on a web server if it
has a URL?

For example, let's say that I want to know when the following file was
created:

http://www.w3schools.com/xml/note.xml

I can get an HTTPMessage object using urllib2, like this:

-------------------------------------------------------------------
#!/usr/bin/python
import urllib2
url = 'http://www.w3schools.com/xml/note.xml'
f = urllib2.urlopen(url)
finfo = f.info()
-------------------------------------------------------------------

My finfo is an HTTPMessage object, which has getdate() and
getdate_tz() methods.  However, they both require a 'name' argument.
I can't figure out what this is...

Am I going down the wrong path?  Is there a path I can go down to get
what I want?

Thanks,

Mike




More information about the Python-list mailing list