Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

反馈缺陷 Bug:后端服务中调用的post方法得不到正确的数据结构 #50

Open
YetSen-26 opened this issue Dec 14, 2023 · 2 comments

Comments

@YetSen-26
Copy link

运行环境:python3.10

调用post方法时输入应该是字典,但是现在输入的是字符串;
查看clickon的代码,发现post里用了dict方法但是他已经被弃用了,所以我改了model_dump来把字符串转成字典,但是还是会报同一个错误

接口返回内容
{ "detail": [ { "type": "model_attributes_type", "loc": [ "body" ], "msg": "Input should be a valid dictionary or object to extract fields from", "input": "{\r\n \"dataType\":1,\r\n \"imageSource\":\"https://static.geetest.com/captcha_v3/batch/v3/55775/2023-12-14T17/word/9e636054c96d472a965546570a968c40.jpg?challenge=1d9bfa8c34a33e1ee8c509d43f200041\",\r\n \"imageID\":\"string\"\r\n}", "url": "https://errors.pydantic.dev/2.5/v/model_attributes_type" } ] }

报错内容INFO: 127.0.0.1:56558 - "POST /clickOn HTTP/1.1" 422 Unprocessable Entity

@20231114
Copy link

20231114 commented May 10, 2024

作者在app/utils/res_api中重写了add_resource, 自定义了clickOn接口的响应模型 output_model, 导致会报错. (应该是自定义的msg格式有问题....)
最省事儿的办法, 把res_api.py中的两行代码给注释掉. 不校验响应模型.

        # if op:
        #     router.routes[0].response_model = resource.output_model

@20231114
Copy link

这个bug找了半天, 结果部署只能windows, 绝了!..........

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants