I am using the code from this link to use python to upload xlsx
files to SFTP
server.
I have modified the parse_args()
method as follows:
def parse_args():
parser = argparse.ArgumentParser(
"Uploads CSV files to TrustYou's sftp server",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'ftpclients.myserver.com', type=str,
help="The name of the sftp server, (eg: sftp.trustyou.com)")
parser.add_argument(
'Mike', type=str,
help="The name of the user, (eg: hotel-california)")
parser.add_argument(
r'C:\Users\Mike\Desktop\uploader\testUpload.xlsx', type=str,
help="The name of the CSV file, (eg: datafile.csv)")
parser.add_argument(
r'C:\Users\Mike\Desktop\uploader\securityKey.ppk', type=str,
help="The path to the private key file, (eg: ~/.ssh/id_rsa)")
return parser.parse_args()
However, I get the following error:
Uploads CSV files to TrustYou's sftp server: error: the following arguments are required: ftpclients.myserver.com, securityKey, C:\Users\Mike\Desktop\uploader\testUpload.xlsx, C:\Users\Mike\Desktop\uploader\securityKey.ppk
Is there any other alternative package better at the job I am trying to achieve? This is my first attempt at this so not sure I am on the right path.