【问题标题】:Passing data to j_security_check with python使用 python 将数据传递给 j_security_check
【发布时间】:2010-11-13 14:33:27
【问题描述】:

我在服务器上有一个 j_security_check 页面,我需要将数据传递给它。我使用 Python urllib2 模块,发送带有 j_username 和 j_password 作为参数的 POST 请求。问题是我有 HTTPError 408 作为响应:“已超出登录过程允许的时间”。 我该怎么办?

【问题讨论】:

    标签: python urllib2 j-security-check


    【解决方案1】:

    您可以尝试先获取登录页面并存储 cookie。 这个 j_security_check-thingie 看起来像 acegi 安全工具。

    import urllib, urllib2
    
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor)
    urllib2.install_opener(opener)
    urllib2.urlopen('http://server/login_form/')
    urllib2.urlopen('http://server/j_security_check',
     data=urllib.urlencode({'j_username':'scott','j_password':'wombat'}))
    

    【讨论】:

      猜你喜欢
      • 2011-12-21
      • 1970-01-01
      • 1970-01-01
      • 2013-01-26
      • 2021-10-23
      • 1970-01-01
      • 2020-02-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多