Fei*_*iii 7 python curl kerberos python-requests
我想在Python中复制以下curl命令.
curl -u : --negotiate -k https://example.com/authenticate
Run Code Online (Sandbox Code Playgroud)
我在这里跟踪了这个pycurl示例,它运行良好 http://www.deplication.net/2014/02/curl-with-kerberos-authentication.html
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
curl.setopt(pycurl.USERPWD, ':')
curl.setopt(pycurl.URL, 'https://example.com/authenticate'
curl.perform()
Run Code Online (Sandbox Code Playgroud)
有没有办法用Python请求模块做到这一点?
谢谢!!
您可以尝试此项目: https: //pypi.org/project/requests-negotiate/,或者如果您使用 Kerberos:https://pypi.org/project/requests-kerberos/
无论使用哪种方式,您的代码都将如下所示:
auth = HTTPNegotiateAuth() # or: HTTPKerberosAuth()
response = requests.get('https://example.com/authenticate', auth=auth, verify=False)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1005 次 |
| 最近记录: |