これが可能なら誰でも知っていますか? ビジネスアカウントのために私のonedriveにいくつかのドキュメントをドロップすることを自動化したいだけです。python3ファイルをondriveまたはsharepointにアップロードしますか?
私はAPPを登録し、秘密とidを持っ
import onedrivesdk
from onedrivesdk.helpers import GetAuthCodeServer
from onedrivesdk.helpers.resource_discovery import ResourceDiscoveryRequest
redirect_uri = 'http://localhost:8080'
client_id = 'appid'
client_secret = 'mysecret'
discovery_uri = 'https://api.office.com/discovery/'
auth_server_url='https://login.live.com/oauth20_authorize.srf?scope=wl.skydrive_update'
#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=resource)
# 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)
を試してみました。しかし、私がこれを走らせたとき、スコープには無効なエラーがあります。さらに、コマンドラインの環境にはあまり適していないWebページを起動しようとします。私は、このSDKはもともとこのスクリプトはlogin.microsoftonlineを持っていたので、このSDKは時代遅れかもしれないと思うが、それは到達できないのでlogin.live.comに変更した。
「このページを表示することができない」だから、企業のために働くことになっていますアカウントも?コードはこの行に刻まれ、永遠にここにとどまっています: 「>>> auth_url = auth.get_auth_url(redirect_uri)」 私はMac上でシークレットとapp id変数を除いて元のコードを使用していますpython 2.7 –
私の悪い、私は、コードは 'code = GetAuthCodeServer.get_auth_code(auth_url、redirect_uri)'、次の行で停止することをお詫びします –