Я использую код из этой ссылки , чтобы использовать python для загрузки xlsx
файлов на сервер SFTP
.
Я изменил метод parse_args()
следующим образом:
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()
Однако я получаю следующую ошибку:
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
Есть ли какой-нибудь другой альтернативный пакет лучше в работе, которую я пытаюсь достичь?Это моя первая попытка, поэтому не уверен, что я на правильном пути.