如何通过在linux上的python中发送操作系统会话数据来协商HTTP请求身份验证?

问题描述 投票:0回答:0

要求:

使用操作系统身份验证通过 python requests 库发送 HTTP 请求(无需手动提供用户/密码)。我可以在 Windows 上的 Python 中使用“from requests_negotiate_sspi import HttpNegotiateAuth”库来执行此操作,因为我以 Active Directory 帐户登录,而在 Linux 平台中,因为它是本地用户(不是 AD 用户),所以我无法执行相同的操作。

我尝试在 Linux 中使用“requests-kerberos”库,但最终出现访问被拒绝错误。那么,有人可以帮我吗?

预期结果:

from requests_kerberos import HTTPKerberosAuth
r = requests.get(URL, auth=HTTPKerberosAuth(), verify=False)

r.status_code = 200
r.json() = {'Content':'<DATA>'}

实际结果:

r.status_code = 401
r.json() =

<h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
<h3>You do not have permission to view this directory or page using the credentials that you supplied.
python http python-requests kerberos
© www.soinside.com 2019 - 2024. All rights reserved.