using config parameters

This commit is contained in:
gal salomon 2020-05-23 15:10:14 +03:00
parent 5dc8bc75ab
commit 1a9d3677f7

View file

@ -76,16 +76,14 @@ import sys
import random import random
from botocore.client import Config from botocore.client import Config
endpoint = 'http://localhost:8000'
access_key = 'b2345678901234567890'
secret_key = 'b234567890123456789012345678901234567890'
region_name = '' region_name = ''
def get_connection(): def get_connection():
conn = boto.connect_s3( conn = boto.connect_s3(
aws_access_key_id = access_key, aws_access_key_id = get_main_aws_access_key(),
aws_secret_access_key = secret_key, aws_secret_access_key = get_main_aws_secret_key(),
host = 'localhost', port = 8000 , host = get_config_host(),
port = get_config_port(),
is_secure=False, # uncomment if you are not using ssl is_secure=False, # uncomment if you are not using ssl
calling_format = boto.s3.connection.OrdinaryCallingFormat(), calling_format = boto.s3.connection.OrdinaryCallingFormat(),
) )
@ -126,11 +124,12 @@ def upload_csv_object(bucket_name,new_key,obj):
def run_s3select(bucket,key,query,column_delim=",",row_delim="\n",quot_char='"',esc_char='\\',csv_header_info="NONE"): def run_s3select(bucket,key,query,column_delim=",",row_delim="\n",quot_char='"',esc_char='\\',csv_header_info="NONE"):
s3 = boto3.client('s3',#'sns', s3 = boto3.client('s3',#'sns',
endpoint_url=endpoint, endpoint_url=get_config_endpoint(),
aws_access_key_id=access_key, aws_access_key_id=get_main_aws_access_key(),
region_name=region_name, region_name=region_name,
aws_secret_access_key=secret_key) aws_secret_access_key=get_main_aws_secret_key())
#config=Config(signature_version='v2')) #config=Config(signature_version='v2'))