我正在尝试访问内部共享点,但我一直无法弄清楚该怎么做。我已经看到了一些示例并提出了一些代码,但是我遇到了401错误。我显然用我的实际凭据替换了USERNAME和PASSWORD,但仍然得到401。我试图访问SharePoint并获取数据列表(跨多个页面)。现在,我正在尝试仅访问该站点并从那里继续。
import requests
from requests.auth import HTTPBasicAuth
from requests_ntlm import HttpNtlmAuth
response = requests.get("http://share-internal.division.com/teams/alpha/Components/Lists/Types/AllItems.aspx", auth=HttpNtlmAuth('DOMAIN\\USERNAME','PASSWORD'))
print (response.status_code)
我还尝试了
之类的基本请求import requests
from requests.auth import HTTPBasicAuth
response = requests.get("http://share-internal.Server.com/teams/Beta/Components/Lists/Workt/AllItems.aspx", auth=HTTPBasicAuth(USERNAME, PASSWORD))
print (response.status_code)
说实话:为了保护隐私,我检查了一些URL