Ir al contenido

TryYourSize()

Esta página aún no está disponible en tu idioma.

Constructortryyoursize

Creates a client for one secret or restricted key. Create it once and reuse it.

def __init__(api_key: str, *, api_version: Optional[str] = None, base_url: str = DEFAULT_BASE_URL, max_retries: int = 2, timeout: float = 30.0, transport: Optional[Transport] = None, sleep: Optional[Callable[[float], None]] = None) -> None
api_keystrObligatorio

A secret key (sk_test_… / sk_live_…) or a restricted key (rk_…).

api_versionOptional[str]Opcional= None

The TYS-Version to send (default: the version this release is built against, API_VERSION).

base_urlstrOpcional= DEFAULT_BASE_URL

API origin; change only for local development.

max_retriesintOpcional= 2

Retries of network errors, timeouts, 429, 5xx and 409 idempotency_key_in_use.

timeoutfloatOpcional= 30.0

Per-attempt timeout in seconds.

transportOptional[Transport]Opcional= None

Replaces the HTTP call (tests).

sleepOptional[Callable[[float], None]]Opcional= None

Replaces the wait between retries (tests).

TryYourSizeError for a missing key or a publishable key.

import os
import tryyoursize
tys = tryyoursize.TryYourSize(os.environ["TRYYOURSIZE_SECRET_KEY"], max_retries=2, timeout=30.0)

¿Te ha resultado útil esta página?