【问题标题】:Connecting to Sharepoint Via Python - UrlLib Error通过 Python 连接到 Sharepoint - UrlLib 错误
【发布时间】:2018-06-20 09:06:41
【问题描述】:

以下代码(更改了变量)是我试图用来联系共享点服务器(并最终从中下载文件)的代码。但我似乎遇到了与 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

【问题讨论】:

    标签: python-3.x sharepoint urllib ntlm


    【解决方案1】:

    你可以试试下面的代码

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

    【讨论】:

    • requests.exceptions.ConnectionError: HTTPConnectionPool(host='sharepoint.example.com', port=80): 最大重试次数超出 url: / (由 NewConnectionError(': 无法建立新连接: [WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立连接失败,因为连接的主机没有响应',))
    • 我现在假设这是某种网络问题。
    • 是的,还要仔细检查 SP 站点 URL
    猜你喜欢
    • 2011-07-07
    • 2011-12-08
    • 1970-01-01
    • 2016-07-07
    • 1970-01-01
    • 1970-01-01
    • 2014-06-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多