Skip to main content

ki_confluence

PyPI version Python License: MIT

Toolkit for Atlassian Confluence using atlassian-python-api==4.0.7:

from atlassian import Confluence

confluence = Confluence(url=BASE_URL, token=API_TOKEN, cloud=True, verify_ssl=certs)

Structures: Space, Page, Table, Point (status lozenge).
Logs: structured JSON via loguru.

Install (PyPI)

pip install ki_confluence
# or
uv add ki_confluence

Requires Python ≥ 3.14.

cp .env.example .env   # CONFLUENCE_BASE_URL, CONFLUENCE_API_TOKEN, ...
ki_confluence --help

Development setup

uv sync
cp .env.example .env
uv run ruff check .
uv run ruff format .
uv run pytest

Build & publish to PyPI

# Build sdist + wheel into dist/
uv build --no-sources

# Dry-run upload
uv publish --dry-run

# Publish to TestPyPI first (recommended)
export UV_PUBLISH_TOKEN=pypi-...   # token from test.pypi.org
uv publish --index testpypi

# Publish to PyPI
export UV_PUBLISH_TOKEN=pypi-...   # token from pypi.org
uv publish

Create an API token at pypi.org/manage/account/token.

Structures

Model Meaning
Space Space key / id / name / homepage
Page Page id, title, space_key, version, body_storage
Table Parsed table: headers + rows
Point Status lozenge to read/change (title, colour)

CLI (4.0.7)

# Space
uv run ki_confluence space get ENG

# Page (space KEY, not numeric id)
uv run ki_confluence page get 123456789
uv run ki_confluence page by-title --space ENG --title "Runbook"
uv run ki_confluence page create --space ENG --title "Runbook" --body '<p>hi</p>'
uv run ki_confluence page update 123456789 --body-file ./page.xml
uv run ki_confluence page set-slot 123456789 --name summary --content '<p>Updated</p>'

# Tables inside a page
uv run ki_confluence table list 123456789
uv run ki_confluence table set-cell 123456789 --row 1 --column 2 --value ok
uv run ki_confluence table set-by-header 123456789 --row-key api --header Status --value ok
uv run ki_confluence table update 123456789 --rows-json '[["api","platform","ok"]]'
uv run ki_confluence table add-row 123456789 --cells-json '["worker","data","up"]'
uv run ki_confluence table add-row 123456789 --row-json '{"Service":"cache","Owner":"platform","Status":"ok"}'

# Status points
uv run ki_confluence point list 123456789
uv run ki_confluence point set 123456789 --match-name PENDING --title HEALTHY --colour Green

# Inspect everything
uv run ki_confluence inspect 123456789

JSON logs go to stderr, e.g.:

{"timestamp":"...","level":"INFO","message":"get_page","extra":{"page_id":"123","component":"client"}}

Library

from ki_confluence import ConfluenceClient, Point, StatusColour, StorageDocument
from ki_confluence.logging import setup_logging

setup_logging("INFO")

with ConfluenceClient.from_env() as client:
    space = client.get_space("ENG")
    page = client.create_page(space_key=space.key, title="Demo", body="<p>x</p>")

    tables = client.list_tables(page.id)
    points = client.list_points(page.id)

    client.set_point(
        page.id,
        match_name="PENDING",
        title="OK",
        colour=StatusColour.GREEN,
    )
    client.set_table_cell_by_header(page.id, "api", "Status", "healthy")

See examples/basic_usage.py.

Notes

  • 4.0.7 uses classic REST (/rest/api/content); create/update take space key.
  • Auth: bearer token. CONFLUENCE_VERIFY_SSL = true / false / CA path.
  • Bodies are Confluence storage XHTML (ac: / ri: macros).

Release files for ki_confluence 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ki_confluence 0.2.0
File Size Uploaded
ki_confluence-0.2.0.tar.gz 15.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ki_confluence 0.2.0
File Interpreter ABI Platform
ki_confluence-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.9 kB

Release files / ki_confluence-0.2.0.tar.gz

Download URL ki_confluence-0.2.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e4b3691995b18a7753113373d6ceedf2766f2714251201635259b2f9518f0ae0
BLAKE2b-256 checksum
How to use checksums
e1864ac995a8b36781685822055da366bd689993f5d4d5870cd9f399f0c20f64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ki_confluence-0.2.0-py3-none-any.whl

Download URL ki_confluence-0.2.0-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
832fb8c37917864132f2aacc364c84275884ee331a9bcb3d9b02d5b2cb67f5d1
BLAKE2b-256 checksum
How to use checksums
e366fd2b6bc7b0be6414a8983971841d6bfac299e8d79b97fb672bd4ab08b9a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page