confluencer.api package¶
Confluence API support.
https://developer.atlassian.com/cloud/confluence/rest/
-
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 plainrequests
HTTP calls.-
CACHE_EXPIRATION
= 36000¶
-
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.Parameters: - 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='body.storage,version,ancestors'
.
-
url
(path)[source]¶ 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
– Apath
was passed that isn’t understood, or malformed.
-
-
confluencer.api.
context
(*args, **kwargs)[source]¶ Context manager providing an API object with standard error logging.