所以我一直在通过 POSTMAN 测试我的服务器 API,结果如下所示:

我使用 AWS Lambda 的目标是显示(在日志中)您从此 API 获得的任何 json 响应。我在 lambda 中的代码如下所示:
import json
import urllib3
def lambda_handler(event, context):
http = urllib3.PoolManager()
response = http.request('GET',
"http://106.10.54.227:9062/api/v1/weather-api",
retries = False)
return response
但是,当我测试这个 lambda 函数时,我得到了这个错误:
Response:
{
"errorMessage": "Unable to marshal response: Object of type HTTPResponse is not JSON serializable",
"errorType": "Runtime.MarshalError"
}
我不明白的是,API 的响应是 JSON 本身,所以我不知道为什么它抱怨它不可序列化。
有没有办法解决这个问题?非常感谢!