(self)
return result
Returns a dictionary with three values:
            length: the total length of the entity-body (can be None)
            first_byte_pos: the position of the first byte (zero based)
            last_byte_pos: the position of the last byte (zero based)
           The range is inclusive; that is, a response 8-9/102 means two bytes
Returns a dictionary with three values:
            length: the total length of the entity-body (can be None)
            first_byte_pos: the position of the first byte (zero based)
            last_byte_pos: the position of the last byte (zero based)
           The range is inclusive; that is, a response 8-9/102 means two bytes
Returns a dictionary with three values : length : the total length of the entity - body ( can be None ) first_byte_pos : the position of the first byte ( zero based ) last_byte_pos : the position of the last byte ( zero based ) The range is inclusive ; that is a response 8 - 9 / 102 means two bytes
def get_content_range(self):
        """Returns a dictionary with three values:
            length: the total length of the entity-body (can be None)
            first_byte_pos: the position of the first byte (zero based)
            last_byte_pos: the position of the last byte (zero based)
           The range is inclusive; that is, a response 8-9/102 means two bytes
        """
        headers = self.get_response_headers()
        if not headers:
            return None
        content_range = headers.get('Content-Range')
        if not content_range:
            return None
        arr = filter(None, string.split(content_range))
        assert arr[0] == "bytes"
        assert len(arr) == 2
        arr = string.split(arr[1], '/')
        assert len(arr) == 2

        brange, total_len = arr
        if total_len == '*':
            # Per RFC, the server is allowed to use * if the length of the
            # entity-body is unknown or difficult to determine
            total_len = None
        else:
            total_len = int(total_len)

        start, end = string.split(brange, '-')
        result = {
            'length'            : total_len,
            'first_byte_pos'    : int(start),
            'last_byte_pos'     : int(end),
        }
        return result
def get_content_range ( self ) : headers = self . get_response_headers ( ) if not headers : return None content_range = headers . get ( 'Content-Range' ) if not content_range : return None arr = filter ( None , string . split ( content_range ) ) assert arr [ 0 ] == "bytes" assert len ( arr ) == 2 arr = string . split ( arr [ 1 ] , '/' ) assert len ( arr ) == 2 brange , total_len = arr if total_len == '*' : # Per RFC, the server is allowed to use * if the length of the # entity-body is unknown or difficult to determine total_len = None else : total_len = int ( total_len ) start , end = string . split ( brange , '-' ) result = { 'length' : total_len , 'first_byte_pos' : int ( start ) , 'last_byte_pos' : int ( end ) , } return result