我在GKE上设置了云端点.我使用谷歌服务帐户启用了JWT Auth.API工作正常.它需要在Authentication头中传递JWT.它不允许过期的JWT按预期工作.除了GCP上的仪表板显示什么都没有.它显示0个请求.0个请求/秒.
我试着检查stackdriver上的日志.它是空的 :(
显然我需要10个声誉才能在问题中显示这个图像.很抱歉给您带来不便 https://i.imgur.com/JaqJ0sp.png
google-cloud-endpoints google-cloud-platform google-kubernetes-engine
我有一个如下的 pydantic 模型。
from pydantic import Json, BaseModel
class Foo(BaseModel):
id: int
bar: Json
Run Code Online (Sandbox Code Playgroud)
Foo.bar 可以解析 JSON 字符串作为输入并将其存储为字典,这很好。
foo = Foo(id=1, bar='{"foo": 2, "bar": 3}')
type(foo.bar) #outputs dict
Run Code Online (Sandbox Code Playgroud)
如果我希望整个对象成为dict我可以做的
foo.dict()
#outputs
{'id': 1, 'bar': {'foo': 2, 'bar': 3}}
Run Code Online (Sandbox Code Playgroud)
但如何导出bar为 JSON 字符串,如下所示
{'id': 1, 'bar': '{"foo": 2, "bar": 3}'}
Run Code Online (Sandbox Code Playgroud)
我想将 JSON 写回数据库。