Fáb*_*ino 2 python python-requests
我正在使用 python 和 confluence REST API 执行发布请求,以便通过脚本更新 confluence 页面。我遇到了一个问题,导致我收到 400 错误以响应
requests.put(url, data = jsonData, auth = (username, passwd), headers = {'Content-Type' : 'application/json'})
我花了一些时间发现其原因是我在更新内容时没有提供增量版本。我已经设法使我的脚本工作,但这不是这个问题的重点。
在我尝试完成这项工作的过程中,我从请求切换到 http.client 连接。使用此模块,我获得了有关我的错误的更多信息:
b'{"statusCode":400,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"Must supply an incremented version when updating Content. No version supplied.","reason":"Bad Request"}'
有没有办法让我在使用请求时获得相同的反馈信息?我已经打开了日志记录,但从未显示此类信息。