The Python SDK authenticates only with bearer API keys or personal access tokens.
HTTP
Authorization: Bearer <api_key>
It does not perform browser login, manage cookies, handle CSRF tokens or create API keys.
Store tokens safely
Load tokens from environment variables or a secret manager:
Python
import osfrom conformaesg import ConformaClientclient = ConformaClient(base_url=os.environ["CONFORMA_BASE_URL"],api_key=os.environ["CONFORMA_API_KEY"],)
Do not hard-code tokens, print them, include them in exception messages or send them to logs. Use the smallest scopes required by the integration. See PAT Integration for token creation and rotation outside the SDK.
Authentication failures
Python
from conformaesg import ConformaClientfrom conformaesg.errors import ConformaAuthenticationError, ConformaPermissionErrorclient = ConformaClient.from_env()try:client.suppliers.list(limit=20)except ConformaAuthenticationError as exc:print("Token missing, expired or invalid", exc.request_id)except ConformaPermissionError as exc:print("Token is valid but does not have the required scope", exc.request_id)
401 Unauthorized maps to ConformaAuthenticationError.
403 Forbidden maps to ConformaPermissionError.