SHARE
TWEET

Untitled

a guest Jul 24th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import boto3
  2.  
  3. def upload_file( filename ):
  4.     session = boto3.Session()
  5.     s3_client = session.client( 's3' )
  6.  
  7.     try:
  8.         print "Uploading file:", filename
  9.  
  10.         tc = boto3.s3.transfer.TransferConfig()
  11.         t = boto3.s3.transfer.S3Transfer( client=s3_client,
  12.                                          config=tc )
  13.  
  14.         t.upload_file( filename, 'my-bucket-name', 'name-in-s3.dat' )
  15.  
  16.     except Exception as e:
  17.         print "Error uploading: %s" % ( e )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top