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
Regular markup notation is also supported (bold, italic..).
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
Hashes for confluenpy-0.1.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bb31cf516ec9304200af70cdbb2a4ca214bcd33e8362c78f5b85afaaee4656e |
|
MD5 | 21f5cb9b7fc65f3d2683b822867b725b |
|
BLAKE2b-256 | aa2ce6f1941754e20c54755d6a7a789c70c251183cdee853136fae3044f5d827 |