One Drive python connection
redirect_uri = 'http://localhost:8000/'
client_secret = 'your app password'
client_id='app id'
api_base_url='https://api.onedrive.com/v1.0/'
scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']
client = onedrivesdk.get_default_client(
client_id=client_id, scopes=scopes)
auth_url = client.auth_provider.get_auth_url(redirect_uri)
#this will block until we have the code
code = GetAuthCodeServer.get_auth_code(auth_url, redirect_uri)
client.auth_provider.authenticate(code, redirect_uri, client_secret)
print(client)
f = onedrivesdk.Folder()
i = onedrivesdk.Item()
i.name = 'python'
i.folder = f
client_secret = 'your app password'
client_id='app id'
api_base_url='https://api.onedrive.com/v1.0/'
scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']
client = onedrivesdk.get_default_client(
client_id=client_id, scopes=scopes)
auth_url = client.auth_provider.get_auth_url(redirect_uri)
#this will block until we have the code
code = GetAuthCodeServer.get_auth_code(auth_url, redirect_uri)
client.auth_provider.authenticate(code, redirect_uri, client_secret)
print(client)
f = onedrivesdk.Folder()
i = onedrivesdk.Item()
i.name = 'python'
i.folder = f
Comments
Post a Comment