Skip to main content
The official Gumnut Python SDK supports Python 3.9 and later. It includes typed request parameters and Pydantic response models, with matching synchronous and asynchronous clients.

Installation

Or with uv:

Create a client

Set GUMNUT_API_KEY in the environment. The client reads it automatically, or you can pass api_key explicitly.
Keep API keys in environment variables or a secrets manager. See API keys for creation and scoping.

Upload and organize a photo

Upload parameters use snake_case and include the source device identifiers and file timestamps required by the API.
library_id is optional for accounts with one library and required when an account has multiple libraries. asset_data accepts bytes, a PathLike, or a (filename, contents, media type) tuple. See the generated API reference for the complete parameter types.
Search supports natural-language content queries and structured filters. See Pagination and filtering for the API’s search and filtering behavior.

Pagination

List methods return cursor pages that are directly iterable. Iterating the page automatically fetches subsequent pages as needed.
For explicit page control, use has_next_page(), next_page_info(), and get_next_page() on the returned page:

Async client

AsyncGumnut exposes the same resources and parameters. Use await for calls and async for for auto-pagination.

Retries and timeouts

The SDK retries connection errors, timeouts, HTTP 408, 409, 429, and 5xx responses twice by default. Configure retries and the request timeout on the client:

Error handling

Connection failures raise APIConnectionError. Non-success HTTP responses raise an APIStatusError subclass with status_code and response properties.

Reference