移除 bbotocore.vendored版本后的依赖怎么解决?

0

【以下的问题经过翻译处理】 客户使用的botocore.vendored即将会被影响(按照这个文档的说法):

https://aws.amazon.com/blogs/developer/removing-the-vendored-version-of-requests-from-botocore/

客户反馈是: 主要问题在于,在Lambda中使用Python时,无法导入requests,因此我们使用botocore.vendored。 您知道在Lambda功能中如何使用requests吗?

profile picture
EXPERT
asked 10 months ago0 views
1 Answer
0

【以下的回答经过翻译处理】 您可以为 requests 库创建一个 Lambda Layer:

https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html

或者在上传时在 Lambda artifact 中包含您的依赖项,看起来像这样:

https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html#python-package-dependencies

在第二种方法中,您只需要在运行 pip 之前将 requests 的版本包含在要求文件中即可。

profile picture
EXPERT
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions