Python 3.x 如何判断onedrive for business onedrive sdk python是否经过身份验证?
我是一名牧师,每周我都会(通过gmail)通过电子邮件将powerpoint、公告和OneDrive上的其他一些项目的链接发送给教堂里的几个人。我更喜欢用Python自动生成链接和发送电子邮件 问题是,当我运行Microsoft提供的代码以允许Python访问我的OneDrive时,我不知道我的应用程序是否经过身份验证,也不知道如何使用我已通过身份验证的事实,如果我确实是 我从微软github项目OneDrive sdk python的OneDrive for Business部分复制了代码(我正在使用OneDrive for Business-我的OneDrive登录以@onmicrosoft.com结尾),并运行了脚本。它打开了一个浏览器选项卡,指向“”。。。等等 输出为“127.0.0.1---[18/Oct/2019 11:42:14]”GET/?code=“后跟一个很长的字符串 我注释掉了下面代码中的最后几行,因为我甚至不确定这应该如何工作,或者我是否应该使用它们;我不知道我可以访问多少服务,甚至不知道这意味着什么Python 3.x 如何判断onedrive for business onedrive sdk python是否经过身份验证?,python-3.x,azure,onedrive,Python 3.x,Azure,Onedrive,我是一名牧师,每周我都会(通过gmail)通过电子邮件将powerpoint、公告和OneDrive上的其他一些项目的链接发送给教堂里的几个人。我更喜欢用Python自动生成链接和发送电子邮件 问题是,当我运行Microsoft提供的代码以允许Python访问我的OneDrive时,我不知道我的应用程序是否经过身份验证,也不知道如何使用我已通过身份验证的事实,如果我确实是 我从微软github项目OneDrive sdk python的OneDrive for Business部分复制了代码(我
from onedrivesdk.helpers import GetAuthCodeServer
from onedrivesdk.helpers.resource_discovery import ResourceDiscoveryRequest
redirect_uri = 'http://localhost:8080'
client_id = '[my actual client id went here]'
client_secret = '[my client secret]'
discovery_uri = 'https://api.office.com/discovery/'
auth_server_url='https://login.microsoftonline.com/common/oauth2/authorize'
auth_token_url='https://login.microsoftonline.com/common/oauth2/token'
http = onedrivesdk.HttpProvider()
auth = onedrivesdk.AuthProvider(http,
client_id,
auth_server_url=auth_server_url,
auth_token_url=auth_token_url)
auth_url = auth.get_auth_url(redirect_uri)
code = GetAuthCodeServer.get_auth_code(auth_url, redirect_uri)
auth.authenticate(code, redirect_uri, client_secret, resource=discovery_uri)
# If you have access to more than one service, you'll need to decide
# which ServiceInfo to use instead of just using the first one, as below.
#service_info = ResourceDiscoveryRequest().get_service_info(auth.access_token)[0]
#auth.redeem_refresh_token(service_info.service_resource_id)
#client = onedrivesdk.OneDriveClient(service_info.service_resource_id + '/_api/v2.0/', auth, http)
我希望别人告诉我下一步要做什么,但自述文件只有一行示例。我是否永远保留代码中的身份验证部分?我是否需要将长“code=”字符串放在某个地方?我是否应该被告知登录?我是否经过身份验证