A Python SDK to connect to the CTI Clarity API server.
Project description
Clarity API SDK for Python
A Python SDK for connecting to the CTI API server, with structured logging included.
Installation
pip install clarity-api-sdk-python
Logging
Logging support is built with structlog.
Set the root logger by setting the environment variable LOG_LEVEL. Otherwise, the default root logging is set to INFO.
"""Example"""
import logging
from cti.logger import initialize_logger, get_logger, ExternalLoggerConfig
initialize_logger(
external_logger_configurations=[
ExternalLoggerConfig(name="urllib3"),
ExternalLoggerConfig(name="httpcore"),
ExternalLoggerConfig(name="httpx"),
ExternalLoggerConfig(name="httpx_auth"),
ExternalLoggerConfig(name="httpx_retries"),
],
handlers=[logging.FileHandler("app.log")]
)
logger_a = get_logger("logger_a")
logger_b = get_logger("logger_b", "WARNING")
# root_logger = logging.getLogger()
# root_logger.setLevel("DEBUG")
logger_a.info("This is info message from logger_a")
logger_a.critical("This is critical message from logger_a")
# Dynamically change the log level of logger_a to WARNING
print("\nChanging logger_a level to WARNING...\n")
logging.getLogger("logger_a").setLevel(logging.WARNING)
logger_a.info("This info message from logger_a should NOT be visible.")
logger_a.warning("This is a new warning message from logger_a.")
logger_b.info("This info message from logger_b should NOT be visible.")
logger_b.warning("This is warning message from logger_b")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clarity_api_sdk_python-0.1.9.tar.gz.
File metadata
- Download URL: clarity_api_sdk_python-0.1.9.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5bf333ad65192ea4f44319d13945b3373091a23daeb6e88ecdac7d7a199f227
|
|
| MD5 |
2de7d90ca7cebbbb120dd731bcf7b735
|
|
| BLAKE2b-256 |
58a0f3f4c8358a33b950cd25fcf80bc1b66ff67a3cc2c91b381fe2e7c996d210
|
File details
Details for the file clarity_api_sdk_python-0.1.9-py3-none-any.whl.
File metadata
- Download URL: clarity_api_sdk_python-0.1.9-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c5bd77afcf5907190ed609c50c26fceae805e6f8d6739551180e4add547ca12
|
|
| MD5 |
930d82e53af6a4a90dd9ebc3b10843bd
|
|
| BLAKE2b-256 |
b99dd0af32ba2ce91811d016bb765758771d96c4ac4f009833a5ef3831dee7bd
|