Python 422 接口参数类型不匹配
微wx笑
2023-11-23【运维日志】
37
0
0关键字:
python requests
以下代码执输出:422 接口参数类型不匹配requeststimeurl = headers = {: ,: ,: ,: ,: }data = {: , : , : , : time.time()}response = requests.post(url, =headers, =data)
以下代码执输出:422 接口参数类型不匹配
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | requests time url = headers = { : , : , : , : , : } data = {: , : , : , : time.time()} response = requests.post(url, = headers, = data) (response.status_code) (response.text) (response.headers) (response.content) |
错误原因是 requests.post 参数的问题
低版本的是
1 | requests.post(url, headers = headers, data = data) |
高版本的要修改为:
1 | requests.post(url, headers=headers, json=data) |
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/service/2023-11-23/1967.html