atlassian-page-client


Nameatlassian-page-client JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA Python client library for interacting with Atlassian Confluence pages
upload_time2025-10-20 10:48:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords atlassian confluence wiki api client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Atlassian Page Client

A Python client library for interacting with Atlassian Confluence pages through the REST API.

## Features

- Simple authentication using email and API token
- Read and modify Confluence page content
- Parse and manipulate HTML content with BeautifulSoup
- Update page versions automatically
- Easy-to-use API for common operations

## Installation

```bash
pip install atlassian-page-client
```

## Quick Start

```python
from atlassian_page_client import AtlassianPageClient

# Initialize the client
client = AtlassianPageClient(
    email="your.email@example.com",
    token="your_api_token", 
    base_url="https://yourcompany.atlassian.net"
)

# Get a page
page = client.get("page_id_here")

# Get the page content for editing
content = page.get_working_page_content()

# Get root element
root = content.get_root()
root.append(content.new_tag('p', string='Hello root'))

# Or find elements by attribute
table = content.find_by_Attribute('ac:local-id', 'table-id')

# Create new elements
new_row = content.new_tag('tr')
cell = content.new_tag('td')
cell.append(content.new_tag('p', string='Hello World'))
new_row.append(cell)

# Add to existing content
table.append(new_row)

# Update the page
updated_page = client.put(page)
```

## API Reference

### AtlassianPageClient

The main client class for interacting with the Atlassian API.

```python
client = AtlassianPageClient(email, token, base_url)
```

#### Methods

- `get(page_id: str) -> AtlassianPage`: Retrieve a page by its ID
- `put(page: AtlassianPage) -> AtlassianPage`: Update a page with modifications

### AtlassianPage

Represents a Confluence page with its content and metadata.

#### Methods

- `get_page_id() -> str`: Get the page ID
- `get_working_page_content() -> AtlassianPageContent`: Get the editable content
- `prettify() -> str`: Get a pretty-printed JSON representation
- `increase_version()`: Increment the page version (called automatically by client.put())

### AtlassianPageContent

Handles the HTML content of a page using BeautifulSoup for parsing and manipulation.

#### Methods

- `find_by_Attribute(attribute_name: str, value: str) -> bs4.element.Tag`: Find element by attribute
- `new_tag(tag_name: str, **kwargs) -> bs4.element.Tag`: Create a new HTML tag
- `get_root() -> bs4.element.Tag`: Get the root BeautifulSoup element
- `prettify() -> str`: Get pretty-printed HTML

## Authentication

You'll need:
1. Your Atlassian email address
2. An API token (create one at https://id.atlassian.com/manage-profile/security/api-tokens)
3. Your Atlassian base URL (e.g., https://yourcompany.atlassian.net)

## Requirements

- Python 3.7+
- requests >= 2.25.0
- beautifulsoup4 >= 4.9.0

## Development

To set up for development:

```bash
git clone https://github.com/yourusername/py-atlassian-page-client.git
cd py-atlassian-page-client
pip install -e .[dev]
```

### Running Tests

The package includes a comprehensive test suite with unit tests, integration tests, and coverage reporting.

**Quick test run:**
```bash
pytest
```

**Run with coverage:**
```bash
pytest --cov=atlassian_page_client --cov-report=term-missing
```

**Run specific test files:**
```bash
pytest tests/test_client.py -v
pytest tests/test_integration.py -v
```

**Use the test runner script:**
```bash
python run_tests.py
```

**Test structure:**
- `tests/test_client.py` - Tests for AtlassianPageClient
- `tests/test_page.py` - Tests for AtlassianPage
- `tests/test_content.py` - Tests for AtlassianPageContent  
- `tests/test_integration.py` - Integration tests
- `tests/test_package_imports.py` - Import and basic functionality tests
- `tests/conftest.py` - Shared test fixtures

## License

MIT License - see LICENSE file for details.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "atlassian-page-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "atlassian, confluence, wiki, api, client",
    "author": null,
    "author_email": "Yannick Zimmermann <yannick.zimmermann@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/ea/57/8782818a29eb9ef9ead58dd443e4c31c6b79a8f7d552e08033c45812f6cd/atlassian_page_client-0.1.0.tar.gz",
    "platform": null,
    "description": "# Atlassian Page Client\n\nA Python client library for interacting with Atlassian Confluence pages through the REST API.\n\n## Features\n\n- Simple authentication using email and API token\n- Read and modify Confluence page content\n- Parse and manipulate HTML content with BeautifulSoup\n- Update page versions automatically\n- Easy-to-use API for common operations\n\n## Installation\n\n```bash\npip install atlassian-page-client\n```\n\n## Quick Start\n\n```python\nfrom atlassian_page_client import AtlassianPageClient\n\n# Initialize the client\nclient = AtlassianPageClient(\n    email=\"your.email@example.com\",\n    token=\"your_api_token\", \n    base_url=\"https://yourcompany.atlassian.net\"\n)\n\n# Get a page\npage = client.get(\"page_id_here\")\n\n# Get the page content for editing\ncontent = page.get_working_page_content()\n\n# Get root element\nroot = content.get_root()\nroot.append(content.new_tag('p', string='Hello root'))\n\n# Or find elements by attribute\ntable = content.find_by_Attribute('ac:local-id', 'table-id')\n\n# Create new elements\nnew_row = content.new_tag('tr')\ncell = content.new_tag('td')\ncell.append(content.new_tag('p', string='Hello World'))\nnew_row.append(cell)\n\n# Add to existing content\ntable.append(new_row)\n\n# Update the page\nupdated_page = client.put(page)\n```\n\n## API Reference\n\n### AtlassianPageClient\n\nThe main client class for interacting with the Atlassian API.\n\n```python\nclient = AtlassianPageClient(email, token, base_url)\n```\n\n#### Methods\n\n- `get(page_id: str) -> AtlassianPage`: Retrieve a page by its ID\n- `put(page: AtlassianPage) -> AtlassianPage`: Update a page with modifications\n\n### AtlassianPage\n\nRepresents a Confluence page with its content and metadata.\n\n#### Methods\n\n- `get_page_id() -> str`: Get the page ID\n- `get_working_page_content() -> AtlassianPageContent`: Get the editable content\n- `prettify() -> str`: Get a pretty-printed JSON representation\n- `increase_version()`: Increment the page version (called automatically by client.put())\n\n### AtlassianPageContent\n\nHandles the HTML content of a page using BeautifulSoup for parsing and manipulation.\n\n#### Methods\n\n- `find_by_Attribute(attribute_name: str, value: str) -> bs4.element.Tag`: Find element by attribute\n- `new_tag(tag_name: str, **kwargs) -> bs4.element.Tag`: Create a new HTML tag\n- `get_root() -> bs4.element.Tag`: Get the root BeautifulSoup element\n- `prettify() -> str`: Get pretty-printed HTML\n\n## Authentication\n\nYou'll need:\n1. Your Atlassian email address\n2. An API token (create one at https://id.atlassian.com/manage-profile/security/api-tokens)\n3. Your Atlassian base URL (e.g., https://yourcompany.atlassian.net)\n\n## Requirements\n\n- Python 3.7+\n- requests >= 2.25.0\n- beautifulsoup4 >= 4.9.0\n\n## Development\n\nTo set up for development:\n\n```bash\ngit clone https://github.com/yourusername/py-atlassian-page-client.git\ncd py-atlassian-page-client\npip install -e .[dev]\n```\n\n### Running Tests\n\nThe package includes a comprehensive test suite with unit tests, integration tests, and coverage reporting.\n\n**Quick test run:**\n```bash\npytest\n```\n\n**Run with coverage:**\n```bash\npytest --cov=atlassian_page_client --cov-report=term-missing\n```\n\n**Run specific test files:**\n```bash\npytest tests/test_client.py -v\npytest tests/test_integration.py -v\n```\n\n**Use the test runner script:**\n```bash\npython run_tests.py\n```\n\n**Test structure:**\n- `tests/test_client.py` - Tests for AtlassianPageClient\n- `tests/test_page.py` - Tests for AtlassianPage\n- `tests/test_content.py` - Tests for AtlassianPageContent  \n- `tests/test_integration.py` - Integration tests\n- `tests/test_package_imports.py` - Import and basic functionality tests\n- `tests/conftest.py` - Shared test fixtures\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python client library for interacting with Atlassian Confluence pages",
    "version": "0.1.0",
    "project_urls": {
        "Bug Reports": "https://github.com/yan/py-atlassian-page-client/issues",
        "Homepage": "https://github.com/yan/py-atlassian-page-client",
        "Source": "https://github.com/yan/py-atlassian-page-client"
    },
    "split_keywords": [
        "atlassian",
        " confluence",
        " wiki",
        " api",
        " client"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8f816d93c3b5e179c73f94009a125560d6ac167e3e63ae1aca1c1350588c77b1",
                "md5": "2bf1e66faa3e3a17da19e38e1739fa0a",
                "sha256": "e5538fed296e2aaf68bff149e324a8d400fff1c40668844cf029e7f9b2f83c7f"
            },
            "downloads": -1,
            "filename": "atlassian_page_client-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bf1e66faa3e3a17da19e38e1739fa0a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6226,
            "upload_time": "2025-10-20T10:48:47",
            "upload_time_iso_8601": "2025-10-20T10:48:47.696007Z",
            "url": "https://files.pythonhosted.org/packages/8f/81/6d93c3b5e179c73f94009a125560d6ac167e3e63ae1aca1c1350588c77b1/atlassian_page_client-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ea578782818a29eb9ef9ead58dd443e4c31c6b79a8f7d552e08033c45812f6cd",
                "md5": "94068338d32614ae51e1423d81dc4921",
                "sha256": "cf72b214e0d53502c31150f6296f5ee010566ffa56b475fc2f0b532564946565"
            },
            "downloads": -1,
            "filename": "atlassian_page_client-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "94068338d32614ae51e1423d81dc4921",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10667,
            "upload_time": "2025-10-20T10:48:49",
            "upload_time_iso_8601": "2025-10-20T10:48:49.014985Z",
            "url": "https://files.pythonhosted.org/packages/ea/57/8782818a29eb9ef9ead58dd443e4c31c6b79a8f7d552e08033c45812f6cd/atlassian_page_client-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-20 10:48:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yan",
    "github_project": "py-atlassian-page-client",
    "github_not_found": true,
    "lcname": "atlassian-page-client"
}
        
Elapsed time: 1.14354s