Skip to content

Instantly share code, notes, and snippets.

@maurorappa
Created April 8, 2016 16:00
Show Gist options
  • Save maurorappa/08b8a48979318962a08a3193e1a3c4f0 to your computer and use it in GitHub Desktop.
Save maurorappa/08b8a48979318962a08a3193e1a3c4f0 to your computer and use it in GitHub Desktop.
S3 upload via proxy (tested with Squid)
import boto
import sys,os.path
from boto.s3.key import Key
file_name=sys.argv[1]
if not os.path.isfile(file_name):
print file_name + " not found!"
sys.exit()
aws_access_key=''
aws_secret=''
bucket_name=''
#conn = boto.connect_s3(aws_access_key,aws_secret,proxy='',proxy_port='80',debug=1)
conn = boto.connect_s3(aws_access_key,aws_secret,proxy='',proxy_port='80')
bucket = conn.get_bucket(bucket_name)
key = bucket.new_key(file_name)
key.set_contents_from_filename(file_name)
print file_name + " uploaded"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment