requests.post 在 python 中没有给出任何回应?

requests.post is not giving any response in python?

我正在使用 Python 请求 2.19.1。 但是我遇到了一个间歇性的问题,当我 post 到特定的 url.

时我根本没有任何反应

我正在尝试检查 LDAP 是否为我提供了无效凭据的预期输出。 格式如下:

requests.post('https://oxhp-member.uhc.com/Member/MemberPortal/j_acegi_security_check',
              credentials_payload) 

我正在 posting

几乎每次都运行良好。但有时,它不会对此做出任何回应。甚至网络问题也给了我们一些回应。正确的?为什么我没有收到上述呼叫的任何响应。

请求中是否存在任何现有错误?

有人请指点我正确的方向。

requests不对"giving back response"负责。您正在使用的服务器 requests 到 post 是。

要查看响应,您必须将其保存在变量中并以某种方式处理它。

resp = requests.post('https://oxhp-member.uhc.com/Member/MemberPortal/j_acegi_security_check',
                     credentials_payload)

print(resp.status_code)
print(resp.content)

resp 包含的内容由服务器负责。