我正在尝试使用 python 下载托管在共享点中的 excel 文件,该共享点是Microsoft Azure 平台的一部分。共享点受密码保护,我有一个帐户和密码,可用于通过浏览器登录,
为了使用 python 脚本进行身份验证,我遵循了以下建议的方法:Sharepoint authentication with python。它使用O365 rest python 客户端库,如下所示:
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
url = 'https://organization.sharepoint.com/sites/something/somepage.aspx'
username = 'userx@organization.com'
password = 'fakepass'
ctx_auth = AuthenticationContext(url)
if ctx_auth.acquire_token_for_user(username, password):
ctx = ClientContext(url, ctx_auth)
else:
print(ctx_auth.get_last_error())
Run Code Online (Sandbox Code Playgroud)
但我收到一条错误消息:
An error occurred while retrieving token: AADSTS50076: Due to a configuration
change made by your administrator, or because you moved to a new location, …Run Code Online (Sandbox Code Playgroud)