CogniteClient

class cognite.client.CogniteClient(config: Optional[cognite.client.config.ClientConfig] = None)

Main entrypoint into Cognite Python SDK.

All services are made available through this object. See examples below.

Parameters:config (ClientConfig) – The configuration for this client.
get(url: str, params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None) → requests.models.Response

Perform a GET request to an arbitrary path in the API.

post(url: str, json: Dict[str, Any], params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None) → requests.models.Response

Perform a POST request to an arbitrary path in the API.

put(url: str, json: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None) → requests.models.Response

Perform a PUT request to an arbitrary path in the API.

delete(url: str, params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None) → requests.models.Response

Perform a DELETE request to an arbitrary path in the API.

version

Returns the current SDK version.

Returns:The current SDK version
Return type:str
config

Returns a config object containing the configuration for the current client.

Returns:The configuration object.
Return type:ClientConfig
class cognite.client.config.ClientConfig(client_name: str, project: str, credentials: cognite.client.credentials.CredentialProvider, api_subversion: Optional[str] = None, base_url: Optional[str] = None, max_workers: Optional[int] = None, headers: Optional[Dict[str, str]] = None, timeout: Optional[int] = None, file_transfer_timeout: Optional[int] = None, debug: bool = False)

Configuration object for the client

Parameters:
  • client_name (str) – A user-defined name for the client. Used to identify number of unique applications/scripts running on top of CDF.
  • project (str) – CDF Project name.
  • credentials (CredentialProvider) – Credentials. e.g. Token, ClientCredentials.
  • api_subversion (str) – API subversion
  • base_url (str) – Base url to send requests to. Defaults to “https://api.cognitedata.com
  • max_workers (int) – Max number of workers to spawn when parallelizing data fetching. Defaults to 10.
  • headers (Dict) – Additional headers to add to all requests.
  • timeout (int) – Timeout on requests sent to the api. Defaults to 30 seconds.
  • file_transfer_timeout (int) – Timeout on file upload/download requests. Defaults to 600 seconds.
  • debug (bool) – Configures logger to log extra request details to stderr.
class cognite.client.config.GlobalConfig

Global configuration object

default_client_config

A default instance of a client configuration. This will be used by the CogniteClient constructor if no config is passed directly. Defaults to None.

Type:Optional[ClientConfig]
disable_gzip

Whether or not to disable gzipping of json bodies. Defaults to False.

Type:bool
disable_pypi_version_check

Whether or not to check for newer SDK versions when instantiating a new client. Defaults to False.

Type:bool
status_forcelist

HTTP status codes to retry. Defaults to {429, 502, 503, 504}

Type:Set[int]
max_retries

Max number of retries on a given http request. Defaults to 10.

Type:int
max_retries_connect

Max number of retries on connection errors. Defaults to 3.

Type:int
max_retry_backoff

Retry strategy employs exponential backoff. This parameter sets a max on the amount of backoff after any request failure. Defaults to 30.

Type:int
max_connection_pool_size

The maximum number of connections which will be kept in the SDKs connection pool. Defaults to 50.

Type:int
disable_ssl

Whether or not to disable SSL. Defaults to False

Type:bool
proxies

Dictionary mapping from protocol to url. e.g. {“https”: “http://10.10.1.10:1080”}

Type:Dict[str, str]