我已经从 升级了 boto3 boto3==1.7.48 to 1.13.11
,这破坏了我所有使用 Moto 的测试。看起来(令人担忧)模拟已经完全停止工作并试图实际访问 s3,这是一个以前工作的示例测试函数:
def upload_video(self, video):
s3 = boto3.client("s3")
s3.create_bucket(Bucket=settings.AWS_STORAGE_BUCKET_NAME)
for media_key in video.upload_media_keys:
s3.upload_file(
os.path.join(
os.path.dirname(os.path.realpath(__file__)), "assets/test.mp4"
),
settings.AWS_STORAGE_BUCKET_NAME,
media_key,
)
但它现在给出了这个错误
File "{path}", line 52, in upload_video
s3.create_bucket(Bucket=settings.AWS_STORAGE_BUCKET_NAME)
File "{path}/lib/python3.7/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "{path}/lib/python3.7/site-packages/botocore/client.py", line 635, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
任何帮助将不胜感激。以下是升级列表:
前:
boto3 == 1.7.48
botocore == 1.10.84
moto == 1.3.6
后:
boto3==1.13.11
botocore==1.16.11
moto==1.3.14