在Python中复制CURL协商连接(使用Kerberos认证)

2024-04-29 03:57:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在Python中复制以下curl命令。在

curl -u : --negotiate -k https://example.com/authenticate

我遵循了这个pycurl的例子,效果很好 http://www.deplication.net/2014/02/curl-with-kerberos-authentication.html

^{pr2}$

有没有一种方法可以用Python请求模块来实现呢?在

谢谢!!在


Tags: https命令comhttpnetexamplewwwwith
1条回答
网友
1楼 · 发布于 2024-04-29 03:57:42

您可以尝试这个项目: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)

相关问题 更多 >