I need to send data from an FTP server into an S3 bucket without saving the file to my local drive. On the internet, I found that we can use io.BytesIO()
as buffer. But my code fails with:
error_perm: 500 Syntax error, command unrecognized.
The script:
ftp = ftplib.FTP(ipaddr)
ftp.login(usr,pswd)
ftp.cwd(folder)
myfile = io.BytesIO()
buffer = ftp.retrbinary(filename, myfile.write)
myfile.seek(0)
s3_resource.Object(bucket_name, folder + "/" + filename).put(Body=buffer)
ftp.quit()
Aany one can help me please?