Python 将本地端点与boto2一起使用

Python 将本地端点与boto2一起使用,python,amazon-s3,boto,localstack,Python,Amazon S3,Boto,Localstack,我尝试使用boto2模拟AWS s3 api调用。 我使用创建本地s3端点,并且可以使用boto3轻松地使用它,如下所示 import boto3 s3_client = boto3.client('s3', endpoint_url='http://localhost:4572') bucket_name = 'my-bucket' s3_client.create_bucket(Bucket=bucket_name) 但我并没有找到使用boto2的方法。有没有更好的方法使用~/.boto或

我尝试使用boto2模拟AWS s3 api调用。 我使用创建本地s3端点,并且可以使用boto3轻松地使用它,如下所示

import boto3
s3_client = boto3.client('s3', endpoint_url='http://localhost:4572')
bucket_name = 'my-bucket'
s3_client.create_bucket(Bucket=bucket_name)
但我并没有找到使用boto2的方法。有没有更好的方法使用~/.boto或~/.aws/config

尝试使用boto2提供终结点,但失败

import boto
boto.s3.S3RegionInfo(name='test-s3-region', endpoint='http://127.0.0.1:4572/')
s3 = boto.s3.connect_to_region('test-s3-region')
print s3.get_bucket('test-poc')
错误:

AttributeError: 'NoneType' object has no attribute 'get_bucket'
我希望为所有AWS服务使用本地端点进行测试。

这对我来说很有用:

import boto
from boto.s3.connection import S3Connection
region = boto.s3.S3RegionInfo(name='test-s3-region', endpoint='http://127.0.0.1:4572/', connection_cls=S3Connection)
conn = region.connect()
print conn.get_bucket('test-poc')

您需要设置属性。

我已经指定了错误消息。此外,我还查看了boto配置,但没有找到指定s3端点的方法。s3=boto.s3.S3RegionInfo(name='test-s3-region',endpoint='s'如何http://127.0.0.1:4572/”).connect()您将如何以这种方式设置sigv4&access/secret信息?还在试图破解这本手册吗