labpack/storage/dropbox.py
def load(self, record_key, secret_key=''):

        ''' 
            a method to retrieve byte data of appdata record

        :param record_key: string with name of record
        :param secret_key: [optional] string used to decrypt data
        :return: byte data for record body
        '''

        title = '%s.load' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key,
            'secret_key': secret_key
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)

    # construct file path
        file_path = '/%s' % record_key
    
    # request file data
        try:
            metadata, response = self.dropbox.files_download(file_path)
        except Exception as err:
            if str(err).find("LookupError('not_found'") > -1:
                raise Exception('%s(record_key=%s) does not exist.' % (title, record_key))
            else:
                raise DropboxConnectionError(title)
        record_data = response.content
    
    # decrypt (if necessary)
        if secret_key:
            from labpack.encryption import cryptolab
            record_data = cryptolab.decrypt(record_data, secret_key)
    
        return record_data
 
            a method to retrieve byte data of appdata record

        :param record_key: string with name of record
        :param secret_key: [optional] string used to decrypt data
        :return: byte data for record body
        
a method to retrieve byte data of appdata record
a method to retrieve byte data of appdata record
def load(self, record_key, secret_key=''):
        title = '%s.load' % self.__class__.__name__
        input_fields = {
            'record_key': record_key,
            'secret_key': secret_key
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)
        file_path = '/%s' % record_key
        try:
            metadata, response = self.dropbox.files_download(file_path)
        except Exception as err:
            if str(err).find("LookupError('not_found'") > -1:
                raise Exception('%s(record_key=%s) does not exist.' % (title, record_key))
            else:
                raise DropboxConnectionError(title)
        record_data = response.content
        if secret_key:
            from labpack.encryption import cryptolab
            record_data = cryptolab.decrypt(record_data, secret_key)
        return record_data
def load ( self , record_key , secret_key = '' ) : title = '%s.load' % self . __class__ . __name__ input_fields = { 'record_key' : record_key , 'secret_key' : secret_key } for key , value in input_fields . items ( ) : if value : object_title = '%s(%s=%s)' % ( title , key , str ( value ) ) self . fields . validate ( value , '.%s' % key , object_title ) file_path = '/%s' % record_key try : metadata , response = self . dropbox . files_download ( file_path ) except Exception as err : if str ( err ) . find ( "LookupError('not_found'" ) > - 1 : raise Exception ( '%s(record_key=%s) does not exist.' % ( title , record_key ) ) else : raise DropboxConnectionError ( title ) record_data = response . content if secret_key : from labpack . encryption import cryptolab record_data = cryptolab . decrypt ( record_data , secret_key ) return record_data
a method to retrieve byte data of appdata record
a method to retrieve byte data of appdata record
''' 
            a method to retrieve byte data of appdata record

        :param record_key: string with name of record
        :param secret_key: [optional] string used to decrypt data
        :return: byte data for record body
        ''' # validate inputs
 # construct file path
 # request file data
 # decrypt (if necessary)

byte data for record body
byte data for record body
self
record_key
string with name of record
string with name of record
secret_key
[optional] string used to decrypt data
[ optional ] string used to decrypt data