No project description provided
Project description
ConfluenPy
ConfluenPy is a Python package that allows you to interact with Atlassian Confluence via the REST API to programmatically create and update documentation pages content.
Example usage
# Example usage
confluence = atlassian.Confluence(
url='https://example.atlassian.net/',
username='your.user@company.com',
password=os.getenv('CONFLUENCE_API_TOKEN')
)
page = Page(title='WonderDocs', space='IsVast', confluence=confluence)
# Add a table of contents
page.body.toc()
# Add a horizontal rule
page.body.horizontal_rule()
# Takes the Readme.md file and converts it to confluence format
with open('README.md', encoding='utf-8') as markdown_text:
markdown = MarkdownToConfluenceConverter.convert(markdown_text.read())
# Only takes the second section of the markdown file
page.body.content += markdown.section(2)
# Upload any local images referenced in the markdown
for file in MarkdownToConfluenceConverter.local_images_to_be_uploaded:
page.attach_content(
content=file.open("rb"),
name=file.name,
)
# Adds some more content
page.body.heading('h1', "Biggest heading")
page.body.block_quote('This is a paragraph')
page.body.code_block(title='tt', content='Wonderful code')
# Update the page
page.update()
Installation
Simply install the package using pip:
pip install confluenpy
Usage
Confluence pages are represented by the Page
class. The page content is handled by a PageBody
object, which represents it in the confluence wiki markup.
The following confluence macros are also supported via the wiki markup (see the MacroMixin
class for details):
- toc
- code block
Markup support
The MarkdownToConfluenceConverter
class allows to convert markdown to confluence wiki markup. The following markdown elements are supported:
- headings
- code blocks
- images (both public and local to the repository, see the example above)
- links
- lists (ordered and unordered)
Regular markup notation is also supported (bold, italic..).
Example:
This content:
# Header
## Header
- list level 1
- list level 2
1. numbered list 1
2. numbered list 2
[here](https://www.google.com)
![excalidraw](excalidraw.png)
will be converted to:
h1. Header
h2. Header
* list level 1
** list level 2
# numbered list 1
## numbered list 2
[here|https://www.google.com]
![excalidraw|excalidraw.png]
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
File details
Details for the file confluenpy-0.1.20.tar.gz
.
File metadata
- Download URL: confluenpy-0.1.20.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b86612bbbff2e1eacef5762ffe4fddc4b723619a8f82b5ddb57a4d23eae665cf |
|
MD5 | 2c05a8dad25ef82eefaf3099f5a6bd2a |
|
BLAKE2b-256 | bb3b6766fc4a26948650bfc887460b613b3b72063a6a70dae27ce96002b6efed |
File details
Details for the file confluenpy-0.1.20-py3-none-any.whl
.
File metadata
- Download URL: confluenpy-0.1.20-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22dd1ae3e68629d2de24ff1f88e645e232be8433e80528de7d94c8d6c251fe90 |
|
MD5 | 06695155c50da1c36b533e4e02784ef7 |
|
BLAKE2b-256 | cd9cccacced26c0a3f8aca4b96400d63ed0600eefa32ed9e3f13e4252d29e505 |