(self, now=None)
This fairly complex and heuristic function refreshes a server
            response for replay.

                - It adjusts date, expires and last-modified headers.
                - It adjusts cookie expiration.
This fairly complex and heuristic function refreshes a server
            response for replay.
This fairly complex and heuristic function refreshes a server response for replay .
def refresh(self, now=None):
        """
            This fairly complex and heuristic function refreshes a server
            response for replay.

                - It adjusts date, expires and last-modified headers.
                - It adjusts cookie expiration.
        """
        if not now:
            now = time.time()
        delta = now - self.timestamp_start
        refresh_headers = [
            "date",
            "expires",
            "last-modified",
        ]
        for i in refresh_headers:
            if i in self.headers:
                d = parsedate_tz(self.headers[i][0])
                if d:
                    new = mktime_tz(d) + delta
                    self.headers[i] = [formatdate(new)]
        c = []
        for i in self.headers["set-cookie"]:
            c.append(self._refresh_cookie(i, delta))
        if c:
            self.headers["set-cookie"] = c
def refresh ( self , now = None ) : if not now : now = time . time ( ) delta = now - self . timestamp_start refresh_headers = [ "date" , "expires" , "last-modified" , ] for i in refresh_headers : if i in self . headers : d = parsedate_tz ( self . headers [ i ] [ 0 ] ) if d : new = mktime_tz ( d ) + delta self . headers [ i ] = [ formatdate ( new ) ] c = [ ] for i in self . headers [ "set-cookie" ] : c . append ( self . _refresh_cookie ( i , delta ) ) if c : self . headers [ "set-cookie" ] = c