python - Python 中的 Runtime.MarshalError
问题描述
我收到此错误。我正在使用 python 3.7 执行 aws lambda 函数的代码以了解 quicksight 仪表板版本。提前致谢!
errorMessage:“无法编组响应:日期时间类型的对象不是 JSON 可序列化的”,
错误类型:“Runtime.MarshalError”
代码-
import boto3
import time
import sys
client = boto3.client('quicksight')
def lambda_handler(event, context):
response = client.list_dashboard_versions(AwsAccountId='11111', DashboardId='2222',MaxResults=10)
return response
解决方案
我快速修复可能是:
import boto3
import time
import sys
import json
client = boto3.client('quicksight')
def lambda_handler(event, context):
response = client.list_dashboard_versions(AwsAccountId='11111', DashboardId='2222',MaxResults=10)
return json.dumps(response, default=str)
推荐阅读
- javascript - 仅在单击时加载选项卡内容
- web3 - 为部署在 RinkeBy 测试网上的智能合约执行 ERC20 代币“传输函数”的原始交易
- android - 将 Android 库发布到 nexus 并维护版本
- tcl - 当通道事件调用过程并检索指针指向的值时使用upvar?
- python - 在熊猫中创建基于列的连接名称和排名
- blazor - 在 JS 函数中更新 Blazor 组件 Div
- arrays - 如何在 Dart 中进行查询搜索?
- .net - 错误 MSB4216:无法运行“ResolveComReference”
- python - Django中可以多次登录吗?
- c# - 多级列表打开xml c#