我想通過需要NTLM身份驗證的代理訪問BASIC身份驗證受保護的網站。我正在使用Python的請求模塊來訪問該網站。如何在請求模塊中爲請求指定多個身份驗證?即我需要提供用於原始網站的代理認證和BASIC憑證的NTLM憑證。我使用下面的代碼:如何在Python的請求模塊中指定多個認證?
import requests
from requests_ntlm import HttpNtlmAuth
proxies = {'https': 'https://myproxy.com:8080', 'http': 'http://myproxy.com:8080'}
ntlm_auth = HttpNtlmAuth('ntlm_username','ntlm_secret')
# how to provide the credentials (BASIC auth) required by the actual website?
r = requests.get("https://myprotectedresource.com",auth=ntlm_auth, proxies=proxies)
這不起作用 –