【问题标题】:requests.post is not giving any response in python?requests.post 在 python 中没有给出任何响应?
【发布时间】:2018-12-16 14:16:03
【问题描述】:

我正在使用 Python 请求 2.19.1 。 但是我遇到了一个间歇性问题,当我发布到特定网址时,我根本没有得到任何回应。

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

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

我要发帖

几乎每次都能正常工作。但有时,它不会对此做出任何回应。甚至网络问题也给了我们一些回应。对?为什么我没有收到上述电话的任何回复。

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

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

【问题讨论】:

    标签: python python-3.x python-2.7 python-requests call


    【解决方案1】:

    requests 不负责“回馈响应”。您使用requests 发布到的服务器是。

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

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

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

    【讨论】:

      猜你喜欢
      • 2012-06-04
      • 2022-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-24
      • 2021-05-07
      • 1970-01-01
      相关资源
      最近更新 更多