python - 通过 Python 使用单点登录访问 Office365 SharePoint
问题描述
我对 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"])
执行此代码时,我收到以下错误:
Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srf
KeyError: 'FedAuth'
谁能指出我正确的方向?
解决方案
最近在寻找类似的解决方案时,我发现了一些有用的东西,您可以在 github 上查看以下代码。
推荐阅读
- angular - mat-ink-bar 没有正确计算初始宽度,它采用 0 宽度
- python - 我在 python 中运行这段代码,但我给出了一个错误,重复检测 LSH
- scala - Scala Map模式匹配问题
- material-ui - 无法使用 material-ui 日期和时间选择器格式化日期
- python - Django 如何查找 ia 用户是否经过身份验证?
- reactjs - 带有 ReactJS 的 useGTF 示例在 Sandbox 中有效,但在本地无效
- c - 为什么我们在插入链表时不使用 free(node) ?
- python - Pandas 重新采样而不聚合
- kotlin - IntelliJ 无法从 ShadowJar 插件解析包
- mysql - 如果两个候选人的分数最高,我怎么能在 MySQL 中获取这两个细节