通过 Python 连接到 Sharepoint - UrlLib 错误

Connecting to Sharepoint Via Python - UrlLib Error

以下代码(变量已更改)是我尝试使用的代码,以便联系共享点服务器(并最终从中下载文件)。但是我似乎遇到了与 urllib 相关的错误,我无法找出原因。

from sharepoint import SharePointSite, basic_auth_opener
server_url = "http://sharepoint.domain.com/"
opener = basic_auth_opener(server_url, "domain/username", "password")
site = SharePointSite(server_url, opener)
sp_list = site.lists
for sp_list in site.lists:
    print(sp_list.id, sp_list.meta['Title'])

报错如下

urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

你可以试试下面的代码吗

import requests from requests_ntlm import HttpNtlmAuth
requests.get("http://sharepoint.domain.com", auth=HttpNtlmAuth('DOMAIN\USERNAME','PASSWORD'))