i'm try to use the ftp lib to upload file to server.
but have the error
TypeError: a bytes-like object is required, not 'str'
When you are opening f on line 107, try 'rb' instead of 'r'
That may be sufficient to do the trick.
For SFTP in the past, I've used paramiko. A code snip is below:
import paramiko
def sendFile(**kwargs):
trans = paramiko.Transport(kwargs['host'], kwargs['port'])
trans.connect(username = kwargs['username'], password = kwargs['password'])
conn = paramiko.SFTPClient.from_transport(trans)
conn.put(sourceFile, destFile)
I've severely redacted the above to get basics across.
(From experience) I'd recommend you do the following as part of a wider solution: