Created
April 8, 2016 16:00
-
-
Save maurorappa/08b8a48979318962a08a3193e1a3c4f0 to your computer and use it in GitHub Desktop.
S3 upload via proxy (tested with Squid)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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