Office365-rest-python-client: ModuleNotFoundError: No module named 'office365.runtime.auth.ClientCredential'

Created on 3 Aug 2020  ·  4Comments  ·  Source: vgrem/Office365-REST-Python-Client

Hi,
I get
ModuleNotFoundError: No module named 'office365.runtime.auth.ClientCredential'
with Office365-REST-Python-Client 2.1.10

Is this module deprecated? What to use instead for client_id + client_secret auth?

question

Most helpful comment

Greetings,

a new version (v2.2.0) has been released and here is an example which demonstrates how to use SharePoint App-Only flow:

from office365.runtime.auth.client_credential import ClientCredential
from office365.sharepoint.client_context import ClientContext

credentials = ClientCredential(client_id, client_secret)
ctx = ClientContext(url).with_credentials(credentials)

target_web = ctx.web
ctx.load(target_web)
ctx.execute_query()

Propose to close this one as resolved.

All 4 comments

Greetings,

indeed, in the 2.1.10 version (or below) ClientCredential module is expected to be imported like this:

from office365.runtime.auth.clientCredential import ClientCredential

Although in the future versions (including the latest one available from GitHub) import path has changed to:

from office365.runtime.auth.client_credential import ClientCredential

Sorry for the inconvenience,
Vadim

It looks like you include ClientCredential.py and clientCredential.py files. This doesn't work well with Windows as its only going to pick one or the other.

Are you going to release the latest on github using client_credential to the alternative index anytime soon?

@minsis, positive, 2.1.11 is planned to be released later this week.

Greetings,

a new version (v2.2.0) has been released and here is an example which demonstrates how to use SharePoint App-Only flow:

from office365.runtime.auth.client_credential import ClientCredential
from office365.sharepoint.client_context import ClientContext

credentials = ClientCredential(client_id, client_secret)
ctx = ClientContext(url).with_credentials(credentials)

target_web = ctx.web
ctx.load(target_web)
ctx.execute_query()

Propose to close this one as resolved.

Was this page helpful?
0 / 5 - 0 ratings