Skip to main content

A Python SDK to connect to the CTI Clarity API server.

Project description

Clarity API SDK for Python

PyPI - Downloads Downloads 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 LOGGING_LEVEL. Otherwise, the default root logging is set to ERROR.

"""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"),
    ]
)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clarity_api_sdk_python-0.1.7.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clarity_api_sdk_python-0.1.7-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file clarity_api_sdk_python-0.1.7.tar.gz.

File metadata

  • Download URL: clarity_api_sdk_python-0.1.7.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for clarity_api_sdk_python-0.1.7.tar.gz
Algorithm Hash digest
SHA256 0af118121219e12d9adbe39cfb77b814070251f59226086dd9c4ef360bea8d80
MD5 c03ffc8802b4fbb75d9010f873477ed7
BLAKE2b-256 d5686251d3d3d41246d48a352049602d66916a36ee43aa145ca5d40cb314d284

See more details on using hashes here.

File details

Details for the file clarity_api_sdk_python-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for clarity_api_sdk_python-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6221c2c58ef732e96c6c1eb6d37f8c05bb3b9075b20f13608cfcd7043ef1b660
MD5 f7325717b2eb5578aad73f8533e516d7
BLAKE2b-256 a1e1dcda08dcac043c5ec54050f849dc25dc45ca78e71089dec47ce3e636de7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page