wriftai
Package initializer for the WriftAI Python client
wriftai package
Submodules
- api module
- authenticated_user module
- common_types 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(api_base_url=None, access_token=None, client_options=None)
Bases: object
Initializes a new instance of the Client class.
- Parameters:
- api_base_url (str | None) – The base URL for the API. If not provided, it falls back to the environment variable WRIFTAI_API_BASE_URL or the default api base url.
- access_token (str | None) – Bearer token for authorization. If not provided it falls back to the environment variable WRIFTAI_ACCESS_TOKEN.
- client_options (ClientOptions | None) – Additional options such as custom headers and timeout. Timeout defaults to 10s on all operations if not specified.
class ClientOptions
Bases: TypedDict
Typed dictionary for specifying additional client options.
headers : dict[str, Any]
Optional HTTP headers to include in requests.
timeout : Timeout
Timeout configuration for requests.This should be an instance of httpx.Timeout.
transport : BaseTransport | None
Optional custom transport for managing HTTP behavior.
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