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.
- from pagesense import (
- PageSenseClientBuilder,
- PageSenseSDKOptions,
- )
- sdk_options = (
- PageSenseSDKOptions()
- .add_log_level("DEBUG")
- .add_polling_interval(300)
- .add_custom_logger(custom_logger)
- .add_custom_storage(custom_storage)
- )
- pagesense_client = (
- PageSenseClientBuilder.create_new_pagesense_client(
- sdk_account_id,
- sdk_key,
- project_name,
- sdk_options
- )
- )