Open YetSen-26 opened 11 months ago
作者在app/utils/res_api中重写了add_resource, 自定义了clickOn接口的响应模型 output_model, 导致会报错. (应该是自定义的msg格式有问题....) 最省事儿的办法, 把res_api.py中的两行代码给注释掉. 不校验响应模型.
# if op:
# router.routes[0].response_model = resource.output_model
这个bug找了半天, 结果部署只能windows, 绝了!..........
运行环境: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