Skip to main content
Solved

Access for the cognite sandbox environment


Forum|alt.badge.img+5

Hi Cognite team,

 

We have been provided the cognite sandbox env, with a credit code. But we are unsure of how to access it.

Can you please support on this.

Best answer by Kathryn Vince-Odozi

Hi Parth, 

I will reply via email to support you with this.

 

Regards,

Kathryn

View original
Did this topic help you find an answer to your question?

2 replies

Kathryn Vince-Odozi
Practitioner

Hi Parth, 

I will reply via email to support you with this.

 

Regards,

Kathryn


APSHANKAR Sagar
Committed

Hi @Kathryn Vince-Odozi ,

We also recently got access to a Cognite Developement environment to supplement our Prod environment. I have not yet been able to operationalize the CogniteClient() object for the development environement or the Pygen model specific clients. 

Specifically, I get 403 errors when I try to list assets or time series, and the data models aren’t found. 

I’d like to know if there are any changes expected to the bolierplate code. Would any of the variables such as tenant_id, client_id be different? Do we need a different client secret? How can we get it?

 

I saw a reference to the environment name in two places:

  1. in the definition of cnf (see below)
  2. in the config.toml file used for pygen generate_sdk_notebook

However, changing it didn’t solve the problem.

 

To work with the Prod environement including our various data models, we use the following boilerplate code:

from cognite.client import CogniteClient, ClientConfig, global_config

from cognite.client.credentials import OAuthClientCredentials



cluster = "westeurope-1"

base_url = "https://westeurope-1.cognitedata.com"

tenant_id = "…………………………………………..."

client_id = "…………………………………………..."




client_secret = os.environ["MAMATASECRET"]





creds = OAuthClientCredentials(

  token_url=f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token",

  client_id=client_id,

  client_secret=client_secret,

  scopes=["https://westeurope-1.cognitedata.com/.default"],

  audience="https://westeurope-1.cognitedata.com"

)



cnf = ClientConfig(

  client_name="pythonSDK",

  base_url=base_url,

  project="mamata-prod",

  credentials=creds

)



global_config.default_client_config = cnf

client = CogniteClient()



from cognite.pygen import load_cognite_client_from_toml, generate_sdk_notebook, generate_sdk



#config_path = os.path.join(os.path.dirname(__file__), 'config.toml')

config_path = 'config.toml'



pygen_client = load_cognite_client_from_toml(config_path)



alert_client = generate_sdk_notebook(

("DOMAIN_MODEL"  , "Alert_Calculations", "11.17"),

pygen_client,

)

mamata_client = generate_sdk_notebook(

( "DOMAIN_MODEL"  , "WS_Domain_Model", "8.1.21"),

pygen_client,

)

 

 

 

 


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings