confluencer.api package

Confluence API support.

class confluencer.api.ConfluenceAPI(endpoint=None, session=None)[source]

Bases: object

Support for using the Confluence API.

Since the Confluence API has excellent support for discovery by e.g. the _links attribute in results, this just adds a thin convenience layer above plain requests HTTP calls.

UA_NAME = 'Confluencer'
add_page(space_key, title, body, parent_id=None, labels=None)[source]

Create a new page.

The body must be in ‘storage’ representation.

delete_page(page, status=None)[source]

Delete an existing page.

To permanently purge trashed content, pass status='trashed'.

get(path, **params)[source]

GET an API path and return result.

If _cached=True is provided, the cached session is used.

getall(path, **params)[source]

Yield all results of a paginated GET.

If the limit keyword argument is set, it is used to stop the generator after the given number of result items.

  • path – Confluence API URI.
  • params – Request parameters.
update_page(page, body, minor_edit=True)[source]

Update an existing page.

The page MUST have been retrieved using expand=',version,ancestors'.


Build an API URL from partial paths.

Parameters:path (str) – Page URL / URI in various formats (tiny, title, id).
Returns:The fully qualified API URL for the page.
Return type:str
Raises:ValueError – A path was passed that isn’t understood, or malformed.
user(username=None, key=None)[source]

Return user details.

Passing neither user name nor key retrieves the current user.

walk(path, **params)[source]

Walk a page tree recursively, and yield the root and all its children.

confluencer.api.context(*args, **kwargs)[source]

Context manager providing an API object with standard error logging.


Display diagnostic info based on the given cause.

Extract the page ID from a so-called tiny link.

See this answer <> for details.


Return tiny link ID for the given page ID.