Skip to main content
January 7, 2023
Solved

Cognite python SDK

  • January 7, 2023
  • 1 reply
  • 105 views

While trying to setup the Google - colab for CDF environment and authentication, i am getting an error. Unable to trace the rootcause of this error.  This code is a part of Notebook setup given in the Hands-On course

 

Link to notebook - Data processing and analysis for IDA course.ipynb - Colaboratory (google.com)

 

TypeError                                 Traceback (most recent call last)Cell In [2], line 57     55 def get_token():     56   return authenticate_device_code(app)['access_token']---> 57 client = CogniteClient(     58 ##  token_url=f'{AUTHORITY_URI}/v2.0',     59   token=get_token,     60   token_client_id=CLIENT_ID,     61   project=COGNITE_PROJECT,     62   base_url=f'https://{CDF_CLUSTER}.cognitedata.com',     63   client_name='cognite-python-dev',     64 )     65 print(client.iam.token.inspect())TypeError: __init__() got an unexpected keyword argument 'token'
    Best answer by Mithila Jayalath

    Hi Eashwar,

    I checked your code and saw that you are using an outdated code to authenticate to the Cognite Client. Can you please check the code here and re-use it accordingly in order to authenticate?
     
    For more information, please refer to the latest python SDK documentation here.

    I hope the above code will slove your issue.

    1 reply

    Mithila Jayalath
    Expert ⭐️⭐️⭐️⭐️
    Expert ⭐️⭐️⭐️⭐️
    January 7, 2023

    Hi Eashwar,

    I checked your code and saw that you are using an outdated code to authenticate to the Cognite Client. Can you please check the code here and re-use it accordingly in order to authenticate?
     
    For more information, please refer to the latest python SDK documentation here.

    I hope the above code will slove your issue.