SDK Configuration

SDK Configuration

Overview  
The PageSense Python SDK provides the PageSenseSDKOptions class to customize the SDK's behaviour during initialization. All configuration options are optional. If no configuration is provided, the SDK uses its default settings. The configured PageSenseSDKOptions instance should be passed to PageSenseClientBuilder during SDK initialization.

The SDK currently supports the following configuration options:

Configuration
Method
Default Value
Description
Log Level
add_log_level()
INFO
Configures the SDK logging level.
Polling Interval
add_polling_interval()
10 seconds
Configures how frequently the SDK synchronises the project configuration from the PageSense server.
Custom Logger
add_custom_logger()
Built-in logger
Registers a custom logger implementation.
User Storage
add_custom_storage()
In-memory storage
Registers a custom user storage implementation for persistent visitor assignment.

Configuring Multiple SDK Options  

Multiple SDK options can be configured by chaining the corresponding methods on the PageSenseSDKOptions instance.
  1. from pagesense import (
  2.     PageSenseClientBuilder,
  3.     PageSenseSDKOptions,
  4. )

  5. sdk_options = (
  6.     PageSenseSDKOptions()
  7.         .add_log_level("DEBUG")
  8.         .add_polling_interval(300)
  9.         .add_custom_logger(custom_logger)
  10.         .add_custom_storage(custom_storage)
  11. )

  12. pagesense_client = (
  13.     PageSenseClientBuilder.create_new_pagesense_client(
  14.         sdk_account_id,
  15.         sdk_key,
  16.         project_name,
  17.         sdk_options
  18.     )
  19. )