[text] m

Viewer

  1. import boto3
  2. import pysftp
  3. client = boto3.client('s3')
  4. s3 = boto3.resource('s3')
  5. s3_bucket=s3.Bucket('<bucket_name>')
  6. key='<file_path>'
  7. res = s3.Object('<bucket_name>','<file_path>')
  8. cnopts = pysftp.CnOpts()
  9. cnopts.hostkeys = None
  10. srv = pysftp.Connection(host="<host>",username="<username>",password="<password>",cnopts=cnopts)
  11. with srv.open("/<sftp_path>/<file_name>","wb") as f:
  12. client.download_fileobj('<bucket_name>',key,f)

Editor

You can edit this paste and save as new:


File Description
  • m
  • Paste Code
  • 28 Sep-2023
  • 438 Bytes
You can Share it: