/[svn.andrew.net.au]/scripts/ready2mirror.py
ViewVC logotype

Diff of /scripts/ready2mirror.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 13 by apollock, Tue Nov 14 06:08:42 2006 UTC revision 14 by apollock, Tue Nov 14 06:10:26 2006 UTC
# Line 45  class Request2(urllib2.Request): Line 45  class Request2(urllib2.Request):
45  def getLastModifiedTime(url):  def getLastModifiedTime(url):
46          """Makes a request for url and returns the Last-Modified header"""          """Makes a request for url and returns the Last-Modified header"""
47    
48          request = urllib2.Request2(url)          request = Request2(url)
49          opener = urllib2.build_opener()          opener = urllib2.build_opener()
50          data = opener.open(request)          data = opener.open(request)
51          return(data.headers.dict["last-modified"])          return(data.headers.dict["last-modified"])
# Line 54  def getLastModifiedTime(url): Line 54  def getLastModifiedTime(url):
54  def URLisNewerThan(url, epoch):  def URLisNewerThan(url, epoch):
55          """Makes an IMS request for url with epoch as the modification time and returns if URL has changed"""          """Makes an IMS request for url with epoch as the modification time and returns if URL has changed"""
56    
57          request = urllib2.Request2(url)          request = Request2(url)
58          request.add_header('If-Modified-Since', time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(epoch)))          request.add_header('If-Modified-Since', time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(epoch)))
59          opener = urllib2.build_opener(DefaultErrorHandler())          opener = urllib2.build_opener(DefaultErrorHandler())
60          data = opener.open(request)          data = opener.open(request)

Legend:
Removed from v.13  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.22