<filename>python/sftp/pythonsftp.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import paramiko
paramiko.util.log_to_file('/tmp/paramiko.log')

# Open a transport

host = "192.168.3.11"
port = 9080
transport = paramiko.Transport((host, port))

# Auth

password = "<PASSWORD>"
username = "0000100000"
transport.connect(username = username, password = password)

# Go!

sftp = paramiko.SFTPClient.from_transport(transport)

# Download

filepath = '/eod/AUTH20161113'
localpath = '/tmp/AUTH20161113'
sftp.get(filepath, localpath)

# Upload

#filepath = '/home/foo.jpg'
#localpath = '/home/pony.jpg'
#sftp.put(localpath, filepath)

# Close

sftp.close()
transport.close()

<filename>python/sftp/pythonsftp.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import paramiko
paramiko.util.log_to_file('/tmp/paramiko.log')

# Open a transport

host = "192.168.3.11"
port = 9080
transport = paramiko.Transport((host, port))

# Auth

password = "<PASSWORD>"
username = "0000100000"
transport.connect(username = username, password = password)

# Go!

sftp = paramiko.SFTPClient.from_transport(transport)

# Download

filepath = '/eod/AUTH20161113'
localpath = '/tmp/AUTH20161113'
sftp.get(filepath, localpath)

# Upload

#filepath = '/home/foo.jpg'
#localpath = '/home/pony.jpg'
#sftp.put(localpath, filepath)

# Close

sftp.close()
transport.close()

#!/usr/bin/env python #-*- coding:utf-8 -*- # Open a transport # Auth # Go! # Download # Upload #filepath = '/home/foo.jpg' #localpath = '/home/pony.jpg' #sftp.put(localpath, filepath) # Close