January 2019
Beginner to intermediate
776 pages
19h 58m
English
This recipe takes a few command-line inputs: the remote hostname, server port, source filename, and destination filename. For the sake of simplicity, we can use default or hard-coded values for these input parameters.
In order to connect to the remote host, we need the username and password, which can be obtained from the user from the command line.
Listing 6.2 explains how to copy a file remotely by SFTP, as shown in the following code:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 6 # This program is optimized for Python 3.5.2. # It may run on any other version with/without modifications. # To make it run on Python 2.7.x, needs some changes due to API differences. # Follow the comments ...
Read now
Unlock full access