Gets the expiration time of the data from the response headers.

        Args:
            headers: dictionary of headers from ESI

        Returns:
            value of seconds from now the data expires
345283
def _get_expiration(self, headers: dict) -> int:
        
        expiration_str = headers.get('expires')
        if not expiration_str:
            return 0
        expiration = datetime.strptime(expiration_str, '%a, %d %b %Y %H:%M:%S %Z')
        delta = (expiration - datetime.utcnow()).total_seconds()
        return math.ceil(abs(delta))
1132084
def expire_at(self, key, _time):
        
        return self._client.expireat(self.get_key(key), round(_time))
621163
def SecondsToZuluTS(secs=None):
	

	if not secs:  secs = int(time.time())

	return(datetime.utcfromtimestamp(secs).strftime("%Y-%m-%dT%H:%M:%SZ"))
481818
def is_expired(self):
        
        if time.time() - self.last_ping > HB_PING_TIME:
            self.ping()

        return (time.time() - self.last_pong) > HB_PING_TIME + HB_PONG_TIME
880344
def _get_time(header, keys, name):
        
        for key in keys:
            try:
                return _to_timestamp(header.pop(key))
            except KeyError:
                continue
        raise _UnsupportedOperation(name)
99918
def get_max_age(self):
        '''
        '''

        default_ttl = self.context.config.RESULT_STORAGE_EXPIRATION_SECONDS
        if self.context.request.max_age == 0:
            return self.context.request.max_age

        return default_ttl
1279599
def getDate(self):
        ""
        date = self.headers.get('date')
        if date:
            date = self.convertTimeString(date)
        return date
244906
def duration(self):
        
        duration = 0.0
        if len(self.events) > 0:
            first = datetime.fromtimestamp(self.events[0]['timestamp'])
            last = datetime.fromtimestamp(self.events[-1]['timestamp'])
            duration = (last - first).total_seconds()
        return duration
575768
def duration_expired(start_time, duration_seconds):
    

    if duration_seconds is not None:
        delta_seconds = datetime_delta_to_seconds(dt.datetime.now() - start_time)

        if delta_seconds >= duration_seconds:
            return True

    return False
1115962
def get_backend_expiry(self, expiry=DEFAULT_EXPIRY):
        
        if expiry == DEFAULT_EXPIRY:
            expiry = self.default_expiry
        elif expiry == 0:
            # avoid time.time() related precision issues
            expiry = -1
        return None if expiry is None else time.time() + expiry
946497
def hasExpired(self):
        
        return (datetime.datetime.utcnow() - self.lastUpdateTime).total_seconds() > self.maxAgeSeconds
713471
def expired(self):
    """"""
    expiry_time = self.expiry_time
    if expiry_time is not None:
      return expiry_time < rdfvalue.RDFDatetime.Now()
    else:
      return False
1168795
def expires_on(self):
    """"""
    timestamp = self._info.get('expirationTime', None)
    if timestamp is None:
      return None
    return _parser.Parser.parse_timestamp(timestamp)
1226288
def _time_to_expiry(expires):
        
        try:
            expires_dt = datetime.strptime(str(expires), '%a, %d %b %Y %H:%M:%S %Z')
            delta = expires_dt - datetime.utcnow()
            return delta.seconds
        except ValueError:
            return 0
939993
def expires(self):
        
        expiration_time = self._properties.get("expirationTime")
        if expiration_time is not None:
            # expiration_time will be in milliseconds.
            return google.cloud._helpers._datetime_from_microseconds(
                1000.0 * float(expiration_time)
            )
763696
def _parse_expires(expires):
    
    # none is used to signify positive infinity
    if expires is None or expires in ('never', 'infinity'):
        return 'infinity'

    try:
        return dateutil.parser.parse(unicode(expires))
    except ValueError as exc:
        pass

    try:
        # use parsedatetime for "human readable" time specs
        exp = pdt.parse(expires)[0]
        # and convert to datetime
        return datetime.datetime.fromtimestamp(time.mktime(exp))
    except ValueError as exc:
        pass

    raise NipapValueError("Invalid date specification for expires")
604464
def is_expired_token(self, client):
        
        if 'expires' not in client:
            return True

        expires = dateutil.parser.parse(client['expires'])
        if expires < datetime.datetime.now():
            return True

        return False