OneDrive / onedrive-sdk-python

OneDrive SDK for Python! https://dev.onedrive.com
MIT License
1.08k stars 189 forks source link

Getting a Runtime Error : There is no current event loop in thread #112

Closed codecraf8 closed 1 month ago

codecraf8 commented 7 years ago

I am trying to upload files to Onedrive via django.

The code is same as mentioned in the documentation

    redirect_uri = settings.ONEDRIVE_REDIRECT_URI
    client_secret = settings.ONEDRIVE_CLIENT_SECRET
    api_base_url = settings.ONEDRIVE_API_BASE_URL
    client_id = settings.ONEDRIVE_CLIENT_ID
    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)

I am getting an error in the line where a try to create a client object.

Stacktrace - https://gist.githubusercontent.com/codecraf8/3a461baad407bec2d2a970c4e2392ce1/raw/d576d12b17e1ae518462c0e77be17e610bbdac92/gistfile1.txt

comnutssg commented 6 years ago

Not sure if you will still need this. It doesn't work while started in a new thread.

jywsn commented 4 years ago

Anyone ever figure out how to fix this? I'm seeing this exact same "RuntimeError: There is no current event loop in thread 'Thread-31'." using Python 3.8.1. I'm not in any way explicitly starting it in a new thread. I'm just redirecting at the browser window level to a Django view that tries to create an onedrivesdk.AuthProvider.

baywet commented 1 month ago

Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #209 for more information