471,330 Members | 1,851 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Getting file timestamp from url

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
1 5060
"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.

Similar topics

7 posts views Thread by Joshua Beall | last post: by
9 posts views Thread by Adam Monsen | last post: by
4 posts views Thread by Mark Harrison | last post: by
8 posts views Thread by Daniele Baroncelli | last post: by
4 posts views Thread by sturnfie | last post: by
3 posts views Thread by seb | last post: by
6 posts views Thread by bill | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.