finding time when url was modified

Steve Holden steve at holdenweb.com
Tue Sep 28 03:46:03 CEST 2004


Ajay wrote:

> hi!
> 
> i am reading a file on the Web. How can i find out when it was last
> modified?
> 
> thanks
> 
That would be the "Last-Modified" HTTP header, when it's present.

Python 2.3.4 (#1, Jun 13 2004, 11:21:03)
[GCC 3.3.1 (cygming special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from urllib import urlopen
 >>> f = urlopen("http://www.holdenweb.com/")
 >>> print f.headers
Server: Microsoft-IIS/5.0
Date: Tue, 28 Sep 2004 01:50:38 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Wed, 25 Aug 2004 17:47:51 GMT
ETag: "242599a4cb8ac41:f460"
Content-Length: 12456

Oops, time I reinstalled the auto-update code to keep my Python links fresh!

regards
  Steve



More information about the Python-list mailing list