By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,965 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,965 IT Pros & Developers. It's quick & easy.

Getting file timestamp from url

P: n/a
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

Nov 17 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"mhearne808[insert-at-sign-here]gmail[insert-dot-here]com"
<mh********@gmail.comwrote:
>
Is is possible to get the timestamp of a file on a web server if it
has a URL?
No, not in the general case.
>For example, let's say that I want to know when the following file was
created:

http://www.w3schools.com/xml/note.xml
Remember that the only information that you get back from the server is the
HTTP request. There is a "Last-Modified" header in the HTTP standards that
says when the page was last modified, and Apache is good about sending it,
but that's all you can find out. Plus, remember that web proxies can
interfere with this.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.