python3 upload files to ondrive or sharepoint?
<p>Anyone know if this is possible?
I just want to automate dropping some documents into my onedrive for business account.</p>

<p>I tried </p>

<pre><code>                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)
</code></pre>

<p>I registered an APP and got a secret and id. But when I ran this I got scope is invalid errors. Plus it tries to launch a webpage which isn't great for a command line kinda environment. I think this SDK might be outdated as well because originally this script had login.microsoftonline, but that wasn't reachable so I changed it to login.live.com.</p>

<p>Onerive's website shows "Not Yet" on "OneDrive SDK for Python" to "OneDrive for Business"
<a href="https://dev.onedrive.com/SDKs.htm" rel="nofollow">https://dev.onedrive.com/SDKs.htm</a></p>

<p>The github sample codes did not work for me either, it tried to popup a window of authentication, but IE can not find the address:</p>

<p>http://('https//login.microsoftonline.com/common/oauth2/authorize',)?redirect_uri=http%3A%2F%2Flocalhost%3A8080&amp;client_id=034xxxx9-9xx8-4xxf-bexx-1bc5xxxxbd0c&amp;response_type=code</p>

<p>or removed all the "-" in client id</p>

<p>http://('https//login.microsoftonline.com/common/oauth2/authorize',)?redirect_uri=http%3A%2F%2Flocalhost%3A8080&amp;client_id=034xxxx99xx84xxfbexx1bc5xxxxbd0c&amp;response_type=code</p>

<p>Either way, I got the same result, IE did not show the popup with a line "This page canât be displayed"</p>

python python-3.x sharepoint upload onedrive