Get industrial data into Python from Open Industrial Data CDF project, thorugh OIDC auth

  • 7 November 2022
  • 0 replies
  • 145 views

Userlevel 3
Badge

In this conversation I will explain / help how to access the data from the Open Industrial Data Project (OID) CDF Project, through the Cognite Python SDK, with authentication through an interactive login token from Cognite Hub’s Azure Active Directory. The video in the article will step by step show you how you can get access to the data, and also link to the relevant information you will need.

 

Steps:
1. Install or update the following python modules/libraries

pip install cognite-sdk
pip install msal
pip install pandas

2. Download the publicdata.py file and store it in your python environments working directory. this file is prefilled with the OIDC ID’s and CDF project values needed to access the CDF project.

3. Open a Jupyter Notebook or python file and import the publicdata.py

from publicdata import c

4. Access the OID CDF project through the CogniteClient object: c, and when the first method is called on the CogniteClient object it will authenticate and redirect towards the AAD tenant and use the received credentials to access the CDF project. try by listing some of the CDF resource types below:

c.assets.list() #to list assets
c.time_series.list() #to list timeseries

5. Enjoy, innovate and be creative with programmatic access to the industrial data in Open industrial data project.

 

This following the video and this method you must use Python 3.8.0 or higher and uses the cognite-sdk version 4.2.1

Hope this was helpfull, for more info write a reply or check out docs.cognite.com


0 replies

Be the first to reply!

Reply