upload to server in python

main.py
import paramiko

host = "your_host"
port = 22
username = "your_username"
password = "your_password"

# Connect to the server
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, username, password)

# Upload the file
sftp = ssh.open_sftp()
local_file_path = "local_path/to/your/file"
remote_file_path = "remote_path/to/your/file"
sftp.put(local_file_path, remote_file_path)

# Close the connection
sftp.close()
ssh.close()
479 chars
22 lines

gistlibby LogSnag