如何在Python中使用Kerberos库?

2024-09-27 00:23:17 发布

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

我尝试使用一些Python库自动登录Kerberos帐户。例如,我找到了requests_kerberos,我的代码是:

import requests
from requests_kerberos import HTTPKerberosAuth, REQUIRED
r = requests.get("https://cas.id.ubc.ca/ubc-cas/login", auth=HTTPKerberosAuth())

然而,甚至在我有机会输入用户名和密码之前,第三行就出现了requests_kerberos.exceptions.MutualAuthenticationError: Unable to authenticate <Response [200]>

有什么不对劲吗?UBC CWL是否支持Kerberos登录?在


Tags: 代码fromhttpsimportidgetrequired帐户
2条回答

我不知道我的理解是否正确,但最后你想连接到UBC服务? 因为我找到了一些Github项目来做这件事:

您可以禁用相互身份验证,如下所示: https://github.com/requests/requests-kerberos

这可能会起作用:

import requests
from requests_kerberos import HTTPKerberosAuth, REQUIRED, OPTIONAL, DISABLED
r = requests.get("https://cas.id.ubc.ca/ubc-cas/login", auth=HTTPKerberosAuth(mutual_authentication=OPTIONAL))

相关问题 更多 >

    热门问题