Python client for the Docmost REST API. Supports API token (Bearer) and email/password (cookie) authentication.
Project description
docmost-sdk (Python)
Python client for the Docmost REST API — same surface as the .NET client.
Installation
pip install docmost-sdk
Requires Python 3.10+.
From source:
cd python
pip install .
Quick start
API token (Bearer)
from docmost import DocmostClient
from docmost.models import PaginationOptions, User
from docmost.response import parse_data
with DocmostClient("https://docs.example.com", api_token="your-api-key") as client:
me = client.users.get_user_info()
user = parse_data(me, User)
print(user.email if user else None)
Email and password (cookie session)
with DocmostClient(
"https://docs.example.com",
email="admin@example.com",
password="secret",
) as client:
spaces = client.spaces.get_workspace_spaces(PaginationOptions(limit=20))
Advanced options
import os
client = DocmostClient(
"https://docs.example.com",
api_token=os.environ["DOCMOST_API_TOKEN"],
login_on_startup=False,
timeout=60.0,
)
API surface
DocmostClient exposes grouped APIs (snake_case), matching OpenAPI tags:
| Attribute | Description |
|---|---|
auth |
Login, logout, password reset, setup |
users |
Current user profile |
workspace |
Workspace settings, members, invites |
spaces |
Spaces and membership |
pages |
Pages, history, tree |
comments |
Page comments |
attachments |
Uploads and file downloads |
search |
Full-text search |
shares |
Public sharing |
groups |
User groups |
export / import_ |
Export and import (import_ — reserved keyword) |
health / version |
Health and version |
api_keys, mfa, license, sso, ai, cloud |
Enterprise features |
Methods return ApiResponse with a data field (usually dict). Use parse_data(response, Model) for typed Pydantic models from docmost.models.
Authentication
| Mode | Constructor |
|---|---|
| API token | DocmostClient(url, api_token="...") |
| Cookie session | DocmostClient(url, email="...", password="...") |
Do not pass both api_token and email/password.
Regenerate from OpenAPI
python3 scripts/generate_sdk.py # from repo root: python3 python/scripts/generate_sdk.py
License
MIT
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 docmost_sdk-1.0.0.tar.gz.
File metadata
- Download URL: docmost_sdk-1.0.0.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58d9a1700552ba16409612ac811eb6adabf65e954c511b18d230dec695b7e239
|
|
| MD5 |
2f2b1876c2e39ef9f21754d0637007c4
|
|
| BLAKE2b-256 |
3828cb658864fb4bd121e346a2df95c81cbc798a96735707b57f4597958b99ad
|
File details
Details for the file docmost_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: docmost_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 71.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3191f476d5a79796cbea0aa7c45f1fa815b3e31bc881ff486409cb94ff8ba328
|
|
| MD5 |
9d300bfadae7fc6e08840f5d95dbff54
|
|
| BLAKE2b-256 |
eef68395a8c88f2a94cd4621994700d781dbadd32f8b607c2fc29288551a3fdf
|