Skip to content

Configuring Settings

All settings for the Incydr SDK Client are managed by the IncydrSettings model, which inherits from pydantic.BaseSettings.

class _incydr_sdk.core.settings.IncydrSettings(*, api_client_id, api_client_secret, url, page_size=100, max_response_history=5, use_rich=True, log_stderr=True, log_file=None, log_level=30, logger=None, user_agent_prefix=None)

Configure settings on the incydr.Client.

Usage:

>> import incydr
>>> client = incydr.Client()
>>> client.settings.page_size = 10

Settings can also be loaded from shell environment variables or .env files. Just prefix a setting's attribute name with INCYDR_ when configuring via enviroment vars.

For example: To load client.settings.api_client_secret from the environment, set INCYDR_API_CLIENT_SECRET="my_secret".

The incydr.Client loads settings in the following priority:

  • Args passed to Client constructor
  • Shell environment variables
  • An .env file in the current working directory
  • An .env file in ~/.config/incydr directory

Attributes:

  • api_client_id: str The API Client Identifier for authentication. env_var=INCYDR_API_CLIENT_ID
  • api_client_secret: str The API Client Secret for authentication. env_var=INCYDR_API_CLIENT_SECRET
  • url: str The URL of your Code42 API gateway instance. env_var=INCYDR_URL
  • page_size: int The default page size for all paginated requests. Defaults to 100. env_var=INCYDR_PAGE_SIZE
  • max_response_history: int The maximum number of responses the incydr.Client.response_history list will store. Defaults to 5. env_var=INCYDR_MAX_RESPONSE_HISTORY
  • log_stderr: bool Enables logging to stderr. Defaults to True. env_var=INCYDR_LOG_STDERR
  • log_file: str The file path or file-like object to write log output to. Defaults to None. env_var=INCYDR_LOG_FILE
  • log_level: int The level for logging messages. Defaults to logging.WARNING. env_var=INCYDR_LOG_LEVEL
  • logger: logging.Logger The logger used for client logging. Cannot be defined via environment variable. Can be replaced with a custom logging.Logger. If a custom Logger is supplied, the other log settings will have no effect and must be configured manually on the custom logger.
  • user_agent_prefix: str Prefixes all User-Agent headers with the supplied string.
  • use_rich: bool Enables rich support in logging and the Python repl. Defaults to True. env_var=INCYDR_USE_RICH