def export_file(self, record, field, event=None, return_format='json'):
        """
        Export the contents of a file stored for a particular record

        Notes
        -----
        Unlike other export methods, this works on a single record.

        Parameters
        ----------
        record : str
            record ID
        field : str
            field name containing the file to be exported.
        event: str
            for longitudinal projects, specify the unique event here
        return_format: ('json'), 'csv', 'xml'
            format of error message

        Returns
        -------
        content : bytes
            content of the file
        content_map : dict
            content-type dictionary
        """
        self._check_file_field(field)
        # load up payload
        pl = self.__basepl(content='file', format=return_format)
        # there's no format field in this call
        del pl['format']
        pl['returnFormat'] = return_format
        pl['action'] = 'export'
        pl['field'] = field
        pl['record'] = record
        if event:
            pl['event'] = event
        content, headers = self._call_api(pl, 'exp_file')
        #REDCap adds some useful things in content-type
        if 'content-type' in headers:
            splat = [kv.strip() for kv in headers['content-type'].split(';')]
            kv = [(kv.split('=')[0], kv.split('=')[1].replace('"', '')) for kv
                  in splat if '=' in kv]
            content_map = dict(kv)
        else:
            content_map = {}
        return content, content_map
def export_file ( self , record , field , event = None , return_format = 'json' ) : self . _check_file_field ( field ) pl = self . __basepl ( content = 'file' , format = return_format ) del pl [ 'format' ] pl [ 'returnFormat' ] = return_format pl [ 'action' ] = 'export' pl [ 'field' ] = field pl [ 'record' ] = record if event : pl [ 'event' ] = event content , headers = self . _call_api ( pl , 'exp_file' ) if 'content-type' in headers : splat = [ kv . strip ( ) for kv in headers [ 'content-type' ] . split ( ';' ) ] kv = [ ( kv . split ( '=' ) [ 0 ] , kv . split ( '=' ) [ 1 ] . replace ( '"' , '' ) ) for kv in splat if '=' in kv ] content_map = dict ( kv ) else : content_map = { } return content , content_map
Export the contents of a file stored for a particular record

        Notes
        -----
        Unlike other export methods, this works on a single record.

        Parameters
        ----------
        record : str
            record ID
        field : str
            field name containing the file to be exported.
        event: str
            for longitudinal projects, specify the unique event here
        return_format: ('json'), 'csv', 'xml'
            format of error message

        Returns
        -------
        content : bytes
            content of the file
        content_map : dict
            content-type dictionary