Python SDK (v0.28.0)Reference
wriftai
Package initializer for the WriftAI Python client
wriftai package
Submodules
- api module
- authenticated_user module
- common_types module
- files module
- hardware module
- model_categories module
- model_versions module
- models module
ModelWithDetailsModelWithDetails.overviewModelWithDetails.latest_versionModelWithDetails.source_urlModelWithDetails.license_urlModelWithDetails.paper_urlModelWithDetails.idModelWithDetails.nameModelWithDetails.created_atModelWithDetails.visibilityModelWithDetails.descriptionModelWithDetails.updated_atModelWithDetails.ownerModelWithDetails.hardwareModelWithDetails.predictions_countModelWithDetails.categories
ModelsSortByModelPaginationOptionsUpdateModelParamsCreateModelParamsModelsResourceModelsResource.delete()ModelsResource.async_delete()ModelsResource.list()ModelsResource.async_list()ModelsResource.get()ModelsResource.async_get()ModelsResource.create()ModelsResource.async_create()ModelsResource.update()ModelsResource.async_update()ModelsResource.search()ModelsResource.async_search()
- pagination module
- predictions module
- users module
Module contents
Package initializer for WriftAI Python Client.
class Client(access_token=None, api_base_url=None, headers=None, http_client=None, async_http_client=None, max_retries=2)
Bases: object
Initializes a new instance of the Client class.
- Parameters:
- access_token (str | None) – Bearer token for authorization. If not provided it falls back to the environment variable WRIFTAI_ACCESS_TOKEN.
- api_base_url (str | None) – The base URL for the API. It must not contain a trailing slash. If not provided, it falls back to the environment variable WRIFTAI_API_BASE_URL or the default URL.
- headers (Mapping *[*str , str ] | None) – Optional HTTP headers to include in every request to WriftAI’s API.
- http_client (Client | None) – Optional custom http client for synchronous requests. If not provided, a default client is created with a 10 second connect timeout.
- async_http_client (AsyncClient | None) – Optional custom http client for asynchronous requests. If not provided, a default client is created with a 10 second connect timeout.
- max_retries (int) – Maximum number of retries for failed requests. Applies to rate-limit (429) and server (5xx) errors. Defaults to 2. Set to 0 to disable.
class PaginationOptions
Bases: TypedDict
Options for pagination.
cursor : NotRequired[str]
Cursor for pagination.
page_size : NotRequired[int]
Number of items per page.
exception WebhookNoSignatureError
Bases: WebhookSignatureVerificationError
Initialize WebhookNoSignatureError.
- Return type: None
exception WebhookNoTimestampError
Bases: WebhookSignatureVerificationError
Initialize WebhookNoTimestampError.
- Return type: None
exception WebhookSignatureMismatchError
Bases: WebhookSignatureVerificationError
Initialize WebhookSignatureMismatchError.
- Return type: None
exception WebhookSignatureVerificationError
Bases: ValueError
Error raised when webhook signature verification fails.
exception WebhookTimestampOutsideToleranceError
Bases: WebhookSignatureVerificationError
Initialize WebhookTimestampOutsideToleranceError.
- Return type: None
verify_webhook(payload, signature, secret, tolerance=300, scheme='v1')
Verify webhook signature.
- Parameters:
- payload (bytes) – Raw webhook request body.
- signature (str) – The signature to verify.
- secret (str) – The webhook secret.
- tolerance (int) – Maximum allowed age of the timestamp in seconds. Defaults to 300.
- scheme (str) – Key for signatures in the signature. Defaults to “v1”.
- Raises:
- WebhookNoTimestampError – Error raised when the timestamp is missing from the signature.
- WebhookNoSignatureError – Error raised when a signature matching the scheme is missing.
- WebhookSignatureMismatchError – Error raised when the signature does not match the expected one.
- WebhookTimestampOutsideToleranceError – Error raised when timestamp is outside the tolerance window.
- Return type: None