0
En utilisant l'exemple du site Aiobotocore et un proxy HTTPS comme ceci:Est-il possible d'utiliser un proxy HTTPS avec le module aiobotocore Python?
import asyncio
import aiobotocore
from aiobotocore.config import AioConfig as Config
AWS_ACCESS_KEY_ID = "xxx"
AWS_SECRET_ACCESS_KEY = "xxx"
async def go(loop):
bucket = 'dataintake'
filename = 'dummy.bin'
folder = 'aiobotocore'
key = '{}/{}'.format(folder, filename)
session = aiobotocore.get_session(loop=loop)
conf = Config(proxies={'http': '<http_proxy>:<http_proxy_port>', 'https': '<https_proxy>:<https_proxy_port>'})
async with session.create_client('s3', region_name='us-west-2',
aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
aws_access_key_id=AWS_ACCESS_KEY_ID,
config=conf) as client:
# upload object to amazon s3
data = b'\x01'*1024
resp = await client.put_object(Bucket=bucket,
Key=key,
Body=data)
print(resp)
# getting s3 object properties of file we just uploaded
resp = await client.get_object_acl(Bucket=bucket, Key=key)
print(resp)
# get object from s3
response = await client.get_object(Bucket=bucket, Key=key)
# this will ensure the connection is correctly re-used/closed
async with response['Body'] as stream:
assert await stream.read() == data
# list s3 objects using paginator
paginator = client.get_paginator('list_objects')
async for result in paginator.paginate(Bucket=bucket, Prefix=folder):
for c in result.get('Contents', []):
print(c)
# delete object from s3
resp = await client.delete_object(Bucket=bucket, Key=key)
print(resp)
loop = asyncio.get_event_loop()
loop.run_until_complete(go(loop))
Je reçois l'erreur suivante:
ValueError: Only http proxies are supported
Est-il possible d'utiliser une certaine façon proxy HTTPS avec aiobotocore d'une autre manière ou Serait-il facile de modifier le code source pour prendre également en charge les proxies HTTPS?
Salut, merci pour le commentaire - J'ai également trouvé ce poste: https://github.com/aio-libs/aiohttp/issues/845 sur le même sujet. Cela semble donc être quelque chose que le groupe derrière est conscient, mais pas quelque chose qui a une haute priorité. Je vais essayer de chercher des alternatives à la place. – kfyhn