Hello Ron!
I'm trying to figure out how to upload a file without having it first locally on my machine. My case is i'm receiving file bytes and i want to send those bytes to my sftp server and upload as file in a specific path. From what i read in the source the put() method uploads files only by local path, so i figured out maybe the open() method would do me a favour. I'm currently trying this:
@classmethod
async def put_file(cls, file_bytes, remote_path, credentials):
conn = await cls.connect(credentials)
async with conn.start_sftp_client() as sftp_client:
try:
file = await sftp_client.open(remote_path, pflags_or_mode=FXF_CREAT)
await file.write(file_bytes)
except asyncssh.SFTPError as err:
return None
and im getting
asyncssh.sftp.SFTPError: Failure
Thank you in advance! :)
Hello Ron!
I'm trying to figure out how to upload a file without having it first locally on my machine. My case is i'm receiving file bytes and i want to send those bytes to my sftp server and upload as file in a specific path. From what i read in the source the put() method uploads files only by local path, so i figured out maybe the open() method would do me a favour. I'm currently trying this:
and im getting
Thank you in advance! :)