コード例 #1
0
    def parse(cls, raw):
        '''
        Parses a string and returns a new instance of the Etag class.
        @param raw:str String to parse
        @return: Etag
        '''
        if not raw or len(raw) == 0:
            raise ValueError('Invalid ETag value \'%s\'.' % raw)

        timestamp, identifier = raw.split('-', 1)
        return cls(timestamp_to_datetime(timestamp), identifier)
コード例 #2
0
 def datetime(self):
     '''
     Gets the date and time covered by this digest.
     @return: datetime 
     '''
     return timestamp_to_datetime(self.id)