【问题标题】:Handling two step authentication using Python requests module使用 Python 请求模块处理两步身份验证
【发布时间】:2023-04-02 07:05:02
【问题描述】:

我的要求是从身份验证服务器捕获 cookie,我可以使用请求模块来实现它。但是,当启用“两步验证”时,这段代码会中断(不返回任何 cookie)。基本上,如果我启用两步验证,它会将安全代码发送到可用作第二级身份验证的注册设备。感谢任何指针。

    import requests

    auth = 'https://auth.corp.xyz.com/authenticate'

    params = {"accoundId": "xyz",
                 "accountPassword": "abc",
                 "appIdKey": "xxxxxxxxxxxxx"
                }

    s = requests.session()
    r = s.post(auth,params = params)


    print r.request.headers['Cookie']
    'd01_ac=9eba0c6ec6f1c09bafb29be785ad9d2373d588d3b1633a418ab932166ea5f832ae036a4f2a89a675adc6e31ebdc7c251215a4a354a085865f6c775fb4cd7544d4c64a429f27fce08bc99058d40497202a4abeedb51f73a53f246fe148560GZVX; dslang=US-EN; myacinfo=DAWTKNV2eed01036859507613988fcc6e5540e93e248a4cbee7243868b1bf5f53b3d698002b4823e872d35c848af2be146529062c6ee05e320367fadfe0e5ae507dd3c07baab03e878c12949efbeb9471111e2b0930c38c05a714f3cd8896c8b63a1201468909a0de019534f1652d49f7e7f280a82627920dbdc8a1ea413f570d16b87c063963712d5932d61a658ff380407f96f34c90e58c223d39ca90f11cc76ca521a3babf4c9f21ea0d35b77ece1b0b175ec21bd74d2d9b108759c38b71d285dde24d21c9d2eac3dfe2e4bd01df6968ebc12fe6bf132d80a0232d6b8ee61a7bfe134b86f6662316431313062326531613231MVRYV2'

【问题讨论】:

    标签:
    python
    python-2.7
    python-requests