def botoGetURL(config, filepath): #config = auxiliary.readConfig(os.path.join(CLAUDE_ROOT, 'claude_config/claude.cfg')) AWS_ACCESS_KEY_ID = auxiliary.read_option(config, 'aws', 'aws_access_key') AWS_SECRET_ACCESS_KEY = auxiliary.read_option(config, 'aws', 'aws_secret_key') AWS_S3_HOST = auxiliary.read_option(config, 'aws', 'aws_s3_host') AWS_S3_PORT = int(auxiliary.read_option(config, 'aws', 'aws_s3_port')) AWS_S3_USE_SSL = auxiliary.str2bool(auxiliary.read_option(config, 'aws', 'aws_s3_use_ssl')) AWS_STORAGE_BUCKET_NAME = auxiliary.read_option(config, 'aws', 'aws_storage_bucket_name') conn = S3Connection( aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY, host=AWS_S3_HOST, port=AWS_S3_PORT, is_secure=AWS_S3_USE_SSL, calling_format=OrdinaryCallingFormat() ) url = conn.generate_url(60, 'GET', bucket=AWS_STORAGE_BUCKET_NAME, key=filepath, force_http=False) return url
def __init__(self, config, section): aws_access_key_id = auxiliary.read_option(config, section, 'aws_access_key_id') aws_secret_access_key = auxiliary.read_option(config, section, 'aws_secret_access_key') name = auxiliary.read_option(config, section, 'name') endpoint = auxiliary.read_option(config, section, 'endpoint') port = int(auxiliary.read_option(config, section, 'port')) path = auxiliary.read_option(config, section, 'path') is_secure = auxiliary.str2bool(auxiliary.read_option(config, section, 'is_secure')) self.args = { 'aws_access_key_id': aws_access_key_id, 'aws_secret_access_key': aws_secret_access_key, } region = boto.ec2.regioninfo.RegionInfo( name=name, endpoint=endpoint, ) self.args['region'] = region self.args['port'] = port self.args['path'] = path self.args['is_secure'] = is_secure self.conn = None