Python pull file
18 Python code examples are found related to "
pull file".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: device_utils.py From Jandroid with BSD 3-Clause "New" or "Revised" License | 6 votes |
def PullFile(self, device_path, host_path, timeout=None, retries=None): """Pull a file from the device. Args: device_path: A string containing the absolute path of the file to pull from the device. host_path: A string containing the absolute path of the destination on the host. timeout: timeout in seconds retries: number of retries Raises: CommandFailedError on failure. CommandTimeoutError on timeout. """ # Create the base dir if it doesn't exist already dirname = os.path.dirname(host_path) if dirname and not os.path.exists(dirname): os.makedirs(dirname) self.adb.Pull(device_path, host_path)
Example 2
Source File: local.py From surround with BSD 3-Clause "New" or "Revised" License | 5 votes |
def pull_file(self, what_to_pull, key, path_to_remote, relative_path_to_remote_file, path_to_local_file): path_to_remote_file = os.path.join(path_to_remote, relative_path_to_remote_file) os.makedirs(os.path.dirname(path_to_local_file), exist_ok=True) copyfile(path_to_remote_file, path_to_local_file) return "info: " + key + " pulled successfully"
Example 3
Source File: adb.py From MSM8974_exploit with GNU General Public License v2.0 | 5 votes |
def pull_file(remote_path, local_path): ''' Pulls the remote path from the device to the local path ''' proc = subprocess.Popen(["adb", "pull", remote_path, local_path], stdout=subprocess.PIPE) proc.wait()
Example 4
Source File: virtual_machine.py From PerfKitBenchmarker with Apache License 2.0 | 5 votes |
def PullFile(self, local_path, remote_path): """Copies a file or a directory from the VM to the local machine. Args: local_path: string. The destination path of the file or directory on the local machine. remote_path: string. The source path of the file or directory on the remote machine. """ self.RemoteCopy(local_path, remote_path, copy_to=False)
Example 5
Source File: base.py From parsl with Apache License 2.0 | 5 votes |
def pull_file(self, remote_source, local_dir): ''' Transport file on the remote side to a local directory Args: remote_source (string): remote_source local_dir (string): Local directory to copy to Returns: destination_path (string) ''' pass
Example 6
Source File: views.py From OMS with Apache License 2.0 | 5 votes |
def file_pull(request): pass ####################################################################################################################### #SaltAPI通过urllib2调用
Example 7
Source File: files.py From RSPET with MIT License | 5 votes |
def pull_file(self, server, args): """Pull a regular text file from the host. Help: <remote_file> [local_file]""" ret = [None,0,""] host = server.get_selected()[0] if len(args) == 0: ret[2] = ("Syntax : %s" % self.__cmd_help__["Pull_File"]) ret[1] = 1 # Invalid Syntax Error Code else: remote_file = args[0] try: local_file = args[1] except IndexError: local_file = remote_file try: host.send(host.command_dict['sendFile']) host.send("%03d" % len(remote_file)) host.send(remote_file) if host.recv(3) == "fna": ret[2] += "File does not exist or Access Denied" ret[1] = 4 # Remote Access Denied Error Code else: try: with open(local_file, "w") as file_obj: filesize = int(host.recv(13)) file_obj.write(host.recv(filesize)) except IOError: ret[2] += "Cannot create local file" ret[1] = 3 # Local Access Denied Error Code except sock_error: host.purge() ret[0] = "basic" ret[1] = 2 # Socket Error Code return ret
Example 8
Source File: AppiumBaseApi.py From AppiumTestProject with Apache License 2.0 | 5 votes |
def do_pull_file(self, path): """Retrieves the file at `path`. Returns the file's content encoded as Base64. :Args: - path - the path to the file on the device """ pass
Example 9
Source File: experiment_reader.py From surround with BSD 3-Clause "New" or "Revised" License | 5 votes |
def pull_experiment_file(self, project_name, experiment_date, path): path = "experimentation/%s/experiments/%s/%s" % (project_name, experiment_date, path) try: return self.storage.pull(path) except FileNotFoundError: return None
Example 10
Source File: experiment_reader.py From surround with BSD 3-Clause "New" or "Revised" License | 5 votes |
def pull_cache_file(self, project_name, path): path = "experimentation/%s/cache/%s" % (project_name, path) if not self.storage.exists(path): return None return self.storage.pull(path)
Example 11
Source File: __init__.py From Sony-PMCA-RE with MIT License | 5 votes |
def pullFile(self, path, localPath='.'): if os.path.isdir(localPath): localPath = os.path.join(localPath, posixpath.basename(path)) with self._openOutputFile(localPath) as f: size = self._req(b'PULL', path.encode('latin1')) print('Writing to %s...' % f.name) usb_transfer_read(self.transfer, f, size, ProgressPrinter().cb)
Example 12
Source File: _android_utils.py From robotframework-appiumlibrary with Apache License 2.0 | 5 votes |
def pull_file(self, path, decode=False): """Retrieves the file at `path` and return it's content. Android only. - _path_ - the path to the file on the device - _decode_ - True/False decode the data (base64) before returning it (default=False) """ driver = self._current_application() theFile = driver.pull_file(path) if decode: theFile = base64.b64decode(theFile) return str(theFile)
Example 13
Source File: _multipass.py From microk8s with Apache License 2.0 | 5 votes |
def pull_file(self, name: str, destination: str, delete: bool = False) -> None: # TODO add instance check. # check if file exists in instance self._run(command=["test", "-f", name]) # copy file from instance source = "{}:{}".format(self.instance_name, name) self._multipass_cmd.copy_files(source=source, destination=destination) if delete: self._run(command=["rm", name])
Example 14
Source File: android_ndk_perf.py From fplutil with Apache License 2.0 | 5 votes |
def pull_package_file(self, package_name, package_file, output_file): """Pull a file from a package's directory. Args: package_name: Name of the package to pull the file from. package_file: Use Adb.get_package_file() to form the path. output_file: Local path to copy the remote file to. """ self.shell_command('run-as %s chmod 666 %s' % (package_name, package_file), 'Unable to make %s readable.' % package_file) self.run_command('pull', [package_file, output_file], 'Unable to copy %s from device to %s.' % (package_file, output_file))
Example 15
Source File: device.py From seal with Apache License 2.0 | 5 votes |
def pull_file(self, source, target): """Copy a file from the source path on the device to the target path on the local machine.""" if not source or not target: raise ValueError try: subprocess.check_call(self.command + ["pull", source, target]) except subprocess.CalledProcessError as e: self.log.warning(e) self.log.warning("Failed to copy \"%s:%s\" to %s", self.name, source, target) raise ValueError else: self.log.debug("Copied \"%s:%s\" to \"%s\"", self.name, source, target)
Example 16
Source File: recorder.py From Airtest with Apache License 2.0 | 5 votes |
def pull_last_recording_file(self, output='screen.mp4'): """ Pull the latest recording file from device. Error raises if no recording files on device. Args: output: default file is `screen.mp4` """ recording_file = 'mnt/sdcard/test.mp4' self.adb.pull(recording_file, output)
Example 17
Source File: remote_fs.py From python-client with Apache License 2.0 | 5 votes |
def pull_file(self: T, path: str) -> str: """Retrieves the file at `path`. Args: path: the path to the file on the device Returns: The file's contents encoded as Base64. """ data = { 'path': path, } return self.execute(Command.PULL_FILE, data)['value']
Example 18
Source File: utils_netperf.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def pull_file(self, netperf_source=None): """ Copy file from remote to local. """ if aurl.is_url(netperf_source): logging.debug("Download URL file to local path") tmp_dir = data_dir.get_download_dir() dst = os.path.join(tmp_dir, os.path.basename(netperf_source)) self.netperf_source = download.get_file(src=netperf_source, dst=dst, hash_expected=self.md5sum) else: self.netperf_source = netperf_source return self.netperf_source