To interact with the Volcengine Log Service (TLS), you must first initialize a TLSService client. It is recommended to use environment variables for authentication to avoid hardcoding AccessKeys.
Important: The endpoint environment variable must NOT include the protocol prefix (e.g., use tls-cn-beijing.ivolces.com instead of https://tls-cn-beijing.ivolces.com).
If you are using STS (Security Token Service), provide the temporary access_key_id and access_key_secret, and ensure VOLCENGINE_TOKEN is set. For non-STS usage, the token part should be empty.
import os
from volcengine.tls.TLSService import TLSService
# Ensure endpoint does not contain http:// or https://
endpoint = os.environ["VOLCENGINE_ENDPOINT"]
region = os.environ["VOLCENGINE_REGION"]
access_key_id = os.environ["VOLCENGINE_ACCESS_KEY_ID"]
access_key_secret = os.environ["VOLCENGINE_ACCESS_KEY_SECRET"]
tls_service = TLSService(endpoint, access_key_id, access_key_secret, region)