hbp_service_client/storage_service/api.py
def download_file_content(self, file_id, etag=None):
        '''Download file content.

        Args:
            file_id (str): The UUID of the file whose content is requested
            etag (str): If the content is not changed since the provided ETag,
                the content won't be downloaded. If the content is changed, it
                will be downloaded and returned with its new ETag.

        Note:
            ETags should be enclosed in double quotes::

                my_etag = '"71e1ed9ee52e565a56aec66bc648a32c"'


        Returns:
            A tuple of ETag and content (etag, content) if the content was
            retrieved. If an etag was provided, and content didn't change
            returns (None, None)::

                ('"71e1ed9ee52e565a56aec66bc648a32c"', 'Hello world!')

        Raises:
            StorageArgumentException: Invalid arguments
            StorageForbiddenException: Server response code 403
            StorageNotFoundException: Server response code 404
            StorageException: other 400-600 error codes
        '''
        if not is_valid_uuid(file_id):
            raise StorageArgumentException(
                'Invalid UUID for file_id: {0}'.format(file_id))

        headers = {'Accept': '*/*'}
        if etag:
            headers['If-None-Match'] = etag

        resp = self._authenticated_request \
            .to_endpoint('file/{}/content/'.format(file_id)) \
            .with_headers(headers) \
            .get()

        if resp.status_code == 304:
            return (None, None)

        if 'ETag' not in resp.headers:
            raise StorageException('No ETag received from the service with the download')

        return (resp.headers['ETag'], resp.content)
def download_file_content(self, file_id, etag=None):
        '''Download file content.

        Args:
            file_id (str): The UUID of the file whose content is requested
            etag (str): If the content is not changed since the provided ETag,
                the content won't be downloaded. If the content is changed, it
                will be downloaded and returned with its new ETag.

        Note:
            ETags should be enclosed in double quotes::

                my_etag = '"71e1ed9ee52e565a56aec66bc648a32c"'


        Returns:
            A tuple of ETag and content (etag, content) if the content was
            retrieved. If an etag was provided, and content didn't change
            returns (None, None)::

                ('"71e1ed9ee52e565a56aec66bc648a32c"', 'Hello world!')

        Raises:
            StorageArgumentException: Invalid arguments
            StorageForbiddenException: Server response code 403
            StorageNotFoundException: Server response code 404
            StorageException: other 400-600 error codes
        '''
        if not is_valid_uuid(file_id):
            raise StorageArgumentException(
                'Invalid UUID for file_id: {0}'.format(file_id))

        headers = {'Accept': '*/*'}
        if etag:
            headers['If-None-Match'] = etag

        resp = self._authenticated_request \
            .to_endpoint('file/{}/content/'.format(file_id)) \
            .with_headers(headers) \
            .get()

        if resp.status_code == 304:
            return (None, None)

        if 'ETag' not in resp.headers:
            raise StorageException('No ETag received from the service with the download')

        return (resp.headers['ETag'], resp.content)
def download_file_content ( self , file_id , etag = None ) : if not is_valid_uuid ( file_id ) : raise StorageArgumentException ( 'Invalid UUID for file_id: {0}' . format ( file_id ) ) headers = { 'Accept' : '*/*' } if etag : headers [ 'If-None-Match' ] = etag resp = self . _authenticated_request . to_endpoint ( 'file/{}/content/' . format ( file_id ) ) . with_headers ( headers ) . get ( ) if resp . status_code == 304 : return ( None , None ) if 'ETag' not in resp . headers : raise StorageException ( 'No ETag received from the service with the download' ) return ( resp . headers [ 'ETag' ] , resp . content )
Download file content.

        Args:
            file_id (str): The UUID of the file whose content is requested
            etag (str): If the content is not changed since the provided ETag,
                the content won't be downloaded. If the content is changed, it
                will be downloaded and returned with its new ETag.

        Note:
            ETags should be enclosed in double quotes::

                my_etag = '"71e1ed9ee52e565a56aec66bc648a32c"'


        Returns:
            A tuple of ETag and content (etag, content) if the content was
            retrieved. If an etag was provided, and content didn't change
            returns (None, None)::

                ('"71e1ed9ee52e565a56aec66bc648a32c"', 'Hello world!')

        Raises:
            StorageArgumentException: Invalid arguments
            StorageForbiddenException: Server response code 403
            StorageNotFoundException: Server response code 404
            StorageException: other 400-600 error codes
Download file content .