remotelogin/connections/base/mixins.py
def put_file_via_cat(self, local_file, remote_path='', remote_folder='', replace=True,
                         check_md5=False, remove_if_bad_md5=False, **put_kwargs):
        """ puts a file using txt messages or base64 encoded data.  Not meant to be used for large files

        Args:
            local_file:
            remote_path:
            remote_folder:
            **put_kwargs:

        Returns:

        """

        remote_path = self._get_remote_path(local_file, remote_path, remote_folder)

        if replace and check_md5:
            remote_path += settings.TEMP_FILE_EXTENSION

        with open(local_file, 'rb') as f:
            data = f.read()

        if not self.os.cmd.HAS_BASE64:
            log.warning('Transferring file as text mode as this OS ({}) does not seem to have a base64 cmd.'
                        'We will be using using cat method ({})'.format(self.os.name, self.os.cmd.CAT))
            self.send_cmd_prompt(self.os.cmd.cat_to_file(remote_path, data), **put_kwargs)
        else:
            data = binascii.b2a_base64(data).decode()[:-1] # remove newline char
            self.send_cmd_prompt(self.os.cmd.cat_to_file(remote_path + '.b64', data), **put_kwargs)
            self.send_cmd_prompt(self.os.cmd.base64_decode_to_file(remote_path + '.b64', remote_path), **put_kwargs)
            self.send_cmd_prompt(self.os.cmd.remove(remote_path + '.b64'), **put_kwargs)

        if check_md5:
            self._check_md5_put(local_file, remote_path, remove_if_bad_md5, replace)

        fattr = self._get_stat_on_remote_file(remote_path)

        return fattr
 puts a file using txt messages or base64 encoded data.  Not meant to be used for large files

        Args:
            local_file:
            remote_path:
            remote_folder:
            **put_kwargs:

        Returns:

        
puts a file using txt messages or base64 encoded data.  Not meant to be used for large files
puts a file using txt messages or base64 encoded data . Not meant to be used for large files
def put_file_via_cat(self, local_file, remote_path='', remote_folder='', replace=True,
                         check_md5=False, remove_if_bad_md5=False, **put_kwargs):
        remote_path = self._get_remote_path(local_file, remote_path, remote_folder)
        if replace and check_md5:
            remote_path += settings.TEMP_FILE_EXTENSION
        with open(local_file, 'rb') as f:
            data = f.read()
        if not self.os.cmd.HAS_BASE64:
            log.warning('Transferring file as text mode as this OS ({}) does not seem to have a base64 cmd.'
                        'We will be using using cat method ({})'.format(self.os.name, self.os.cmd.CAT))
            self.send_cmd_prompt(self.os.cmd.cat_to_file(remote_path, data), **put_kwargs)
        else:
            data = binascii.b2a_base64(data).decode()[:-1] 
            self.send_cmd_prompt(self.os.cmd.cat_to_file(remote_path + '.b64', data), **put_kwargs)
            self.send_cmd_prompt(self.os.cmd.base64_decode_to_file(remote_path + '.b64', remote_path), **put_kwargs)
            self.send_cmd_prompt(self.os.cmd.remove(remote_path + '.b64'), **put_kwargs)
        if check_md5:
            self._check_md5_put(local_file, remote_path, remove_if_bad_md5, replace)
        fattr = self._get_stat_on_remote_file(remote_path)
        return fattr
def put_file_via_cat ( self , local_file , remote_path = '' , remote_folder = '' , replace = True , check_md5 = False , remove_if_bad_md5 = False , ** put_kwargs ) : remote_path = self . _get_remote_path ( local_file , remote_path , remote_folder ) if replace and check_md5 : remote_path += settings . TEMP_FILE_EXTENSION with open ( local_file , 'rb' ) as f : data = f . read ( ) if not self . os . cmd . HAS_BASE64 : log . warning ( 'Transferring file as text mode as this OS ({}) does not seem to have a base64 cmd.' 'We will be using using cat method ({})' . format ( self . os . name , self . os . cmd . CAT ) ) self . send_cmd_prompt ( self . os . cmd . cat_to_file ( remote_path , data ) , ** put_kwargs ) else : data = binascii . b2a_base64 ( data ) . decode ( ) [ : - 1 ] self . send_cmd_prompt ( self . os . cmd . cat_to_file ( remote_path + '.b64' , data ) , ** put_kwargs ) self . send_cmd_prompt ( self . os . cmd . base64_decode_to_file ( remote_path + '.b64' , remote_path ) , ** put_kwargs ) self . send_cmd_prompt ( self . os . cmd . remove ( remote_path + '.b64' ) , ** put_kwargs ) if check_md5 : self . _check_md5_put ( local_file , remote_path , remove_if_bad_md5 , replace ) fattr = self . _get_stat_on_remote_file ( remote_path ) return fattr
puts a file using txt messages or base64 encoded data.
puts a file using txt messages or base64 encoded data .
""" puts a file using txt messages or base64 encoded data.  Not meant to be used for large files

        Args:
            local_file:
            remote_path:
            remote_folder:
            **put_kwargs:

        Returns:

        """ # remove newline char
None
self
local_file
None
remote_path
None
remote_folder
None
replace
check_md5
remove_if_bad_md5
**put_kwargs
None