Python client for the Nuclino API
Project description
Nuclino Python API Client
A Python client library for interacting with the Nuclino API. This library provides a clean, Pythonic interface to Nuclino's REST API, making it easy to manage workspaces, items, and collections programmatically.
Features
- Typed client methods and object models
- Support for core Nuclino API v0 resources
- Configurable client-side request throttling
- Structured exception hierarchy
- Convenient helper methods for common operations
- Support for items, collections, workspaces, teams, users, and files
- Cursor-based list endpoints via
limitandafter
Installation
pip install nuclino
Quick Start
from nuclino import NuclinoAPI
# Initialize the client
client = NuclinoAPI(api_key="your-api-key")
# Get items from a workspace
items = client.get_items(workspace_id="your-workspace-id")
# Create a new item
new_item = client.create_item(
workspace_id="your-workspace-id",
title="My New Item",
content="This is the content of my new item"
)
# Update an item
updated_item = client.update_item(
item_id="your-item-id",
title="Updated Title",
content="Updated content"
)
# Delete an item
client.delete_item("your-item-id")
Features in Detail
Items and Collections
The library supports all operations on both items and collections:
- Create, read, update, and delete items
- Create, read, update, and delete collections
- Organize items within collections
- Manage item content and metadata
Error Handling
The library provides detailed error handling with specific exception classes:
NuclinoAuthenticationError: Authentication failuresNuclinoPermissionError: Permission-related issuesNuclinoValidationError: Invalid request parametersNuclinoNotFoundError: Resource not foundNuclinoRateLimitError: Rate limit exceededNuclinoTimeoutError: Request timed outNuclinoServerError: Server-side errors
Rate Limiting
Built-in rate limiting support helps prevent API quota exhaustion:
- Automatic client-side request throttling
- Automatic retry handling for rate-limit responses
- Configurable requests per minute limit
Type Safety
The library exposes typed client methods and model objects:
- Public methods have return type annotations
- Models preserve the raw API payload while exposing Python-style attribute access
- Support for IDE autocompletion
- Checked with mypy in CI
API Reference
Main Client
class NuclinoAPI:
def __init__(
self,
api_key: str,
base_url: str = "https://api.nuclino.com/v0",
requests_per_minute: int = 140,
timeout: float = 30.0,
rate_limit_retries: int = 3,
)
Item Operations
def get_items(
team_id: Optional[str] = None,
workspace_id: Optional[str] = None,
limit: Optional[int] = None,
after: Optional[str] = None
) -> List[Union[Item, Collection]]
def get_item(item_id: str) -> Union[Item, Collection]
def create_item(
workspace_id: Optional[str] = None,
parent_id: Optional[str] = None,
object: str = "item",
title: Optional[str] = None,
content: Optional[str] = None,
index: Optional[int] = None
) -> Union[Item, Collection]
def update_item(
item_id: str,
title: Optional[str] = None,
content: Optional[str] = None
) -> Union[Item, Collection]
def delete_item(item_id: str) -> BaseDeleteResponse
Collection Operations
def get_collection(collection_id: str) -> Collection
def create_collection(
workspace_id: Optional[str] = None,
parent_id: Optional[str] = None,
title: Optional[str] = None,
index: Optional[int] = None
) -> Collection
def update_collection(
collection_id: str,
title: Optional[str] = None
) -> Collection
def delete_collection(collection_id: str) -> BaseDeleteResponse
Error Handling
try:
client.get_item("non-existent-id")
except NuclinoNotFoundError:
print("Item not found")
except NuclinoAuthenticationError:
print("Invalid API key")
except NuclinoPermissionError:
print("Insufficient permissions")
except NuclinoRateLimitError as e:
print(f"Rate limit exceeded. Try again in {e.retry_after} seconds")
Development
uv sync --dev
uv run ruff check .
uv run mypy nuclino
uv run pytest
uv build
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments
- Built for the Nuclino API
- Inspired by modern Python API client design patterns
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nuclino-0.2.0.tar.gz.
File metadata
- Download URL: nuclino-0.2.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0155bb2501d45ddadf40fd4039f850ab9c502559690570ea81bb9c14abfa5610
|
|
| MD5 |
7848e7a5dd94d6ec551345b1d7ca7fd5
|
|
| BLAKE2b-256 |
a60e1dbb1c6d61a8843c6588c7caae9dd19d21089b21292771f4abd2d3074800
|
File details
Details for the file nuclino-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nuclino-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c4f9b81c5cc581cf56cd1bf7acc2cc457042b1d22c4ce6422ec1c3a42fa7d0a
|
|
| MD5 |
44a0d0078c36fe1781510d5be50a6682
|
|
| BLAKE2b-256 |
bfb72be2fd1e7708c1e017f256df8dac25ed88cf24d856409351b44020de9ecf
|