Hi,
I want to use the IP and Port as Variables in my S3 Proxy Server Connect command using the boto3 module.
This is the Python AWS S3 connect, which works fine:
s3client = boto3.resource(
's3',
aws_access_key_id = args.AWS_ACCESS_KEY_ID,
aws_secret_access_key=args.AWS_SECRET_ACCESS_KEY,
config=Config(proxies={'https': '192.168.88.1:3128'}),
)
I want to use the same AWS S3 connection, but with IP and Port as Variables (e.g. args.proxy, args.port).
This is what I want to achieve:
s3client = boto3.resource(
's3',
aws_access_key_id = args.AWS_ACCESS_KEY_ID,
aws_secret_access_key=args.AWS_SECRET_ACCESS_KEY,
config=Config(proxies={'https': 'args.proxy: args.port'}),
)
Variable in S3 Proxy Server Verbindung mit Boto3
Hi,
I solved it:
s3client = boto3.resource(
's3',
aws_access_key_id = args.AWS_ACCESS_KEY_ID,
aws_secret_access_key=args.AWS_SECRET_ACCESS_KEY,
#before: config=Config(proxies={'https': '192.168.88.1:3128'}),
config=Config(proxies={'https': '%s:%s' % (args.proxy, args.port)})
)
I solved it:
s3client = boto3.resource(
's3',
aws_access_key_id = args.AWS_ACCESS_KEY_ID,
aws_secret_access_key=args.AWS_SECRET_ACCESS_KEY,
#before: config=Config(proxies={'https': '192.168.88.1:3128'}),
config=Config(proxies={'https': '%s:%s' % (args.proxy, args.port)})
)
- sls
- User
- Beiträge: 480
- Registriert: Mittwoch 13. Mai 2015, 23:52
- Wohnort: Country country = new Zealand();
Hi dugjibe,
'args.proxy: args.port' is just one String though. It should rather look like:
Oh, too late. Anyways, aforementioned solution uses the format()-function.
Cheers, sls
Code: Alles auswählen
config=Config(proxies={'https': 'args.proxy: args.port'})
Code: Alles auswählen
{'https': "{0}:{1}".format(proxy_ip, proxy_port)}
Cheers, sls
When we say computer, we mean the electronic computer.