通过Python单点登录访问Office365 SharePoint

通过Python单点登录访问Office365 SharePoint,python,sharepoint,office365,single-sign-on,Python,Sharepoint,Office365,Single Sign On,我对SharePoint了解不多,但我的任务是使用Python下载SharePoint列表。SharePoint是Office365,可通过单点登录进行访问。我找到了以下有关如何连接到SharePoint的示例: from office365.runtime.auth.user_credential import UserCredential from office365.sharepoint.client_context import ClientContext ctx = ClientCon

我对SharePoint了解不多,但我的任务是使用Python下载SharePoint列表。SharePoint是Office365,可通过单点登录进行访问。我找到了以下有关如何连接到SharePoint的示例:

from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.client_context import ClientContext
ctx = ClientContext('https://<site>.sharepoint.com').with_credentials(UserCredential('domain\\user', 'password'))
web = ctx.web
ctx.load(web)
ctx.execute_query()
print(web.properties["Url"])

有人能给我指出正确的方向吗?

最近,当我在搜索类似的解决方案时,我发现了一些有用的东西,您可以在github上查看下面的代码


我尝试在那里实现示例。我收到一个类似的错误:“从XML响应检索令牌时出错:AADSTS50006:签名验证失败,因为签名无效。从中检索身份验证cookie时出错。”https://.sharepoint.com“/\u vti\u bin/idcrl.svc/
Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srf
KeyError: 'FedAuth'