Vin*_*lvo 5 python python-requests aws-lambda python-3.8
requests从 botocore.vendored使用的技巧不再适用于 AWS Lambda 上的 Python 3.8,我认为它包括最新的 botocore-1.13。此版本不再嵌入requests. 导入它有效,但包实际上是空的。
[ERROR] AttributeError: module 'botocore.vendored.requests' has no attribute 'post'
Run Code Online (Sandbox Code Playgroud)
有没有办法requests在本机 lambda上导入?这是一个基本的过程,为非常简单的 Lambda 打包代码会很痛苦。
或者,任何人都有另一种技巧来调用 API-Gateway 而没有requests?
not*_*est -2
单独安装requests依赖项。
$ pip install requests
使用下面的导入。
import requests
response = requests.get('https://...')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6259 次 |
| 最近记录: |