Configure the client
Close the client when you’re done with it, or use it as a context manager (
with Nohead() as nohead:). nohead.with_options(timeout=5, max_retries=0) returns a client with other settings that shares the same connections.
Async
AsyncNohead has the same methods: await them, and loop over lists with async for.
Models
- Responses are Pydantic models, in
nohead.models. The main ones (Record,Draft,Collection,Field,Asset,Webhook) can also be imported fromnohead. A record’s values are in itsdatadict. - They’re lenient on purpose, because the API adds fields and values without notice: fields the SDK doesn’t know yet are kept in
model_extra, enums are plain strings, and a response that doesn’t match the models at all is returned unvalidated with aNoheadWarningrather than raised. - Timestamps are
datetimes. - Request bodies are typed with the TypedDicts in
nohead.params, and filters with those innohead.types, so a type checker catches a misspelled field.
Images
nohead.images.image_url builds an image URL with resizing options: see Images.
Methods
Every method follows a resource of the API:records, drafts, collections, fields, migrations, assets, webhooks, search, audit_events and more. Each endpoint in the API reference shows its call in Python, and the README lists them by resource.
Source
The SDK is open source, under the MIT license. Report issues and follow releases on GitHub:nohead-io/nohead-python
Loading repository data...