Confluence Assistant Skills Library
Python library for Confluence Cloud REST API - shared utilities for the Confluence Assistant Skills project.
Features
- ConfluenceClient - HTTP client with retry logic, pagination, and file uploads
- ConfigManager - Multi-source configuration (env vars, JSON files, profiles)
- Error Handling - Exception hierarchy and decorators for clean error handling
- Validators - Input validation for page IDs, space keys, CQL queries, etc.
- Formatters - Output formatting for pages, spaces, tables, JSON, CSV
- ADF Helper - Atlassian Document Format conversion (Markdown ↔ ADF)
- XHTML Helper - Legacy storage format conversion
- Cache - File-based response caching with TTL
Installation
pip install confluence-assistant-skills-lib
Quick Start
from confluence_assistant_skills import (
get_confluence_client,
validate_page_id,
format_page,
markdown_to_adf,
)
# Set environment variables:
# CONFLUENCE_SITE_URL=https://your-site.atlassian.net
# CONFLUENCE_EMAIL=your-email@example.com
# CONFLUENCE_API_TOKEN=your-api-token
# Get a configured client
client = get_confluence_client()
# Get a page
page_id = validate_page_id("12345")
page = client.get(f"/api/v2/pages/{page_id}")
print(format_page(page))
# Create content from Markdown
content = markdown_to_adf("# Hello\n\nThis is **bold** text.")
Direct Client Usage
from confluence_assistant_skills import ConfluenceClient
client = ConfluenceClient(
base_url="https://your-site.atlassian.net",
email="your-email@example.com",
api_token="your-api-token",
timeout=30,
max_retries=3,
)
# GET request
page = client.get("/api/v2/pages/12345")
# POST request
new_page = client.post("/api/v2/pages", json_data={
"spaceId": "123456",
"title": "New Page",
"body": {"representation": "atlas_doc_format", "value": "..."}
})
# Pagination
for page in client.paginate("/api/v2/pages", params={"space-id": "123456"}):
print(page["title"])
# File upload
result = client.upload_file(
"/api/v2/attachments",
file_path="/path/to/file.pdf",
additional_data={"pageId": "12345"}
)
Configuration
Environment Variables
export CONFLUENCE_SITE_URL="https://your-site.atlassian.net"
export CONFLUENCE_EMAIL="your-email@example.com"
export CONFLUENCE_API_TOKEN="your-api-token"
export CONFLUENCE_PROFILE="production" # Optional
Profile Configuration
Create .claude/settings.local.json:
{
"confluence": {
"default_profile": "production",
"profiles": {
"production": {
"url": "https://company.atlassian.net",
"default_space": "DOCS"
},
"sandbox": {
"url": "https://company-sandbox.atlassian.net",
"default_space": "TEST"
}
}
}
}
Use profiles:
from confluence_assistant_skills import get_confluence_client
# Uses default profile or CONFLUENCE_PROFILE env var
client = get_confluence_client()
# Use specific profile
client = get_confluence_client(profile="sandbox")
Error Handling
from confluence_assistant_skills import (
handle_errors,
ConfluenceError,
AuthenticationError,
NotFoundError,
ValidationError,
)
@handle_errors
def main():
# Validation errors
page_id = validate_page_id(user_input) # Raises ValidationError if invalid
# API errors are caught and formatted
page = client.get(f"/api/v2/pages/{page_id}")
if __name__ == "__main__":
main() # Errors are caught, formatted, and exit with appropriate code
Validators
from confluence_assistant_skills import (
validate_page_id, # Numeric string validation
validate_space_key, # Space key format
validate_cql, # CQL query syntax
validate_content_type, # page, blogpost, etc.
validate_url, # URL format
validate_email, # Email format
validate_title, # Page title constraints
validate_label, # Label format
validate_limit, # Pagination limit
)
page_id = validate_page_id("12345") # Returns "12345"
space_key = validate_space_key("docs") # Returns "DOCS" (normalized)
cql = validate_cql('space = "DOCS"') # Validates syntax
ADF Conversion
from confluence_assistant_skills import (
markdown_to_adf,
adf_to_markdown,
text_to_adf,
adf_to_text,
create_heading,
create_paragraph,
create_bullet_list,
)
# Convert Markdown to ADF
adf = markdown_to_adf("""
# My Document
This is a **bold** paragraph.
- Item 1
- Item 2
```python
print("Hello")
""")
Convert ADF back to Markdown
markdown = adf_to_markdown(adf)
Build ADF programmatically
from confluence_assistant_skills import create_adf_doc doc = create_adf_doc([ create_heading("Title", level=1), create_paragraph(text="Hello, World!"), create_bullet_list(["Item 1", "Item 2", "Item 3"]), ])
## Caching
```python
from confluence_assistant_skills import Cache, cached
# Direct cache usage
cache = Cache(default_ttl=300) # 5 minutes
cache.set("key", {"data": "value"})
value = cache.get("key")
# Decorator usage
@cached(ttl=300)
def get_page(page_id):
return client.get(f"/api/v2/pages/{page_id}")
# First call hits API, subsequent calls use cache
page = get_page("12345")
API Reference
Client
ConfluenceClient- HTTP client classcreate_client()- Factory functionget_confluence_client()- Get configured client from config
Config
ConfigManager- Configuration management classget_config()- Get merged configurationget_default_space()- Get default space keyget_space_keys()- Get configured space keys
Errors
ConfluenceError- Base exceptionAuthenticationError- 401 errorsPermissionError- 403 errorsValidationError- 400 errorsNotFoundError- 404 errorsRateLimitError- 429 errorsConflictError- 409 errorsServerError- 5xx errors
Formatters
format_page(),format_space(),format_comment()format_table()- ASCII table formattingformat_json()- JSON formattingexport_csv()- CSV exportprint_success(),print_warning(),print_info()
ADF Helper
markdown_to_adf(),adf_to_markdown()text_to_adf(),adf_to_text()create_*()- Node creation functionsvalidate_adf()- Validate ADF structure
XHTML Helper
xhtml_to_markdown(),markdown_to_xhtml()xhtml_to_adf(),adf_to_xhtml()validate_xhtml()- Validate XHTML structure
Cache
Cache- File-based cache classcached()- Caching decoratorget_cache()- Get global cache instance
Contributing
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit a pull request
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=src/confluence_assistant_skills
License
MIT License - see LICENSE for details.
Related Projects
- Confluence Assistant Skills - Claude Code skills for Confluence automation
Metadata
Release files for confluence-assistant-skills 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| confluence_assistant_skills-0.2.0.tar.gz | 73.3 kB | With provenance | Details for confluence_assistant_skills-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| confluence_assistant_skills-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for confluence_assistant_skills-0.2.0-py3-none-any.whl |
Total release size: 167.2 kB
Release files / confluence_assistant_skills-0.2.0.tar.gz
| Download URL | confluence_assistant_skills-0.2.0.tar.gz |
|---|---|
| Size | 73.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
513d37fc879b4d24233fa8ee144e771a3df198f52eee48b25d8a164c2d3bc768
|
|
BLAKE2b-256 checksum How to use checksums |
eef1924d9627518a81a82efcf6ea1ccd6046daa4a705251c87a49cdaacf13fec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.
Transparency logRelease files / confluence_assistant_skills-0.2.0-py3-none-any.whl
| Download URL | confluence_assistant_skills-0.2.0-py3-none-any.whl |
|---|---|
| Size | 93.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3698ac38b5358fc629bfaaa4248bf8dc8dff98413a35128ec10f6e2615a8adb
|
|
BLAKE2b-256 checksum How to use checksums |
7ffc1b33f78cf86170c38c1bbea8fa1560734619056c336bbe119bc4bea764c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.
Transparency logSecurity for confluence-assistant-skills 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for confluence_assistant_skills-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.