| Name | Type |
|---|---|
| url | str |
| api_key | Optional[str] |
| username | Optional[str] |
| session | Optional[requests.Session] |
| oauth2 | Optional[dict] |
| token | Optional[str] |
| cloud | Optional[bool] |
| number_of_retries | Optional[int] |
| min_retry_seconds | Optional[int] |
| max_retry_seconds | Optional[int] |
| confluence_kwargs | Optional[dict] |
| cookies | Optional[dict] |
| space_key | Optional[str] |
| page_ids | Optional[List[str]] |
| label | Optional[str] |
| cql | Optional[str] |
| include_restricted_content | bool |
| include_archived_content | bool |
| include_attachments | bool |
| include_comments | bool |
| include_labels | bool |
| content_format | ContentFormat |
| limit | Optional[int] |
| max_pages | Optional[int] |
| ocr_languages | Optional[str] |
| keep_markdown_format | bool |
| keep_newlines | bool |
| attachment_filter_func | Optional[Callable[[dict], bool]] |
Paginate the various methods to retrieve groups of pages.
Unfortunately, due to page size, sometimes the Confluence API
doesn't match the limit value. If limit is >100 confluence
seems to cap the response to 100. Also, due to the Atlassian Python
package, we don't get the "next" values from the "_links" key because
they only return the value from the result key. So here, the pagination
starts from 0 and goes until the max_pages, getting the limit number
of pages with each request. We have to manually check if there
are more docs based on the length of the returned list of pages, rather than
just checking for the presence of a next key in the response like this page
would have you do:
https://developer.atlassian.com/server/confluence/pagination-in-the-rest-api/
:param retrieval_method: Function used to retrieve docs :type retrieval_method: callable :return: List of documents :rtype: List
Load Confluence pages.
Port of https://llamahub.ai/l/confluence This currently supports username/api_key, Oauth2 login, personal access token or cookies authentication.
Specify a list page_ids and/or space_key to load in the corresponding pages into Document objects, if both are specified the union of both sets will be returned.
You can also specify a boolean include_attachments to include attachments, this
is set to False by default, if set to True all attachments will be downloaded and
ConfluenceLoader will extract the text from the attachments and add it to the
Document object. Currently supported attachment types are: PDF, PNG, JPEG/JPG,
SVG, Word and Excel.
Confluence API supports difference format of page content. The storage format is the
raw XML representation for storage. The view format is the HTML representation for
viewing with macros are rendered as though it is viewed by users. You can pass
a enum content_format argument to specify the content format, this is
set to ContentFormat.STORAGE by default, the supported values are:
ContentFormat.EDITOR, ContentFormat.EXPORT_VIEW,
ContentFormat.ANONYMOUS_EXPORT_VIEW, ContentFormat.STORAGE,
and ContentFormat.VIEW.
Hint: space_key and page_id can both be found in the URL of a page in Confluence
Example:
.. code-block:: python
from langchain_community.document_loaders import ConfluenceLoader
loader = ConfluenceLoader( url="https://yoursite.atlassian.com/wiki", username="me", api_key="12345", space_key="SPACE", limit=50, ) documents = loader.load()
loader = ConfluenceLoader( url="https://confluence.yoursite.com/", username="me", api_key="your_password", cloud=False, space_key="SPACE", limit=50, ) documents = loader.load()
:param url: description
:type url: str
:param api_key: description, defaults to None
:type api_key: str, optional
:param username: description, defaults to None
:type username: str, optional
:param oauth2: description, defaults to {}
:type oauth2: dict, optional
:param token: description, defaults to None
:type token: str, optional
:param cloud: description, defaults to True
:type cloud: bool, optional
:param number_of_retries: How many times to retry, defaults to 3
:type number_of_retries: Optional[int], optional
:param min_retry_seconds: defaults to 2
:type min_retry_seconds: Optional[int], optional
:param max_retry_seconds: defaults to 10
:type max_retry_seconds: Optional[int], optional
:param confluence_kwargs: additional kwargs to initialize confluence with
:type confluence_kwargs: dict, optional
:param cookies: description, defaults to {}
:type cookies: dict, optional
:param space_key: Space key retrieved from a confluence URL, defaults to None
:type space_key: Optional[str], optional
:param page_ids: List of specific page IDs to load, defaults to None
:type page_ids: Optional[List[str]], optional
:param label: Get all pages with this label, defaults to None
:type label: Optional[str], optional
:param cql: CQL Expression, defaults to None
:type cql: Optional[str], optional
:param include_restricted_content: defaults to False
:type include_restricted_content: bool, optional
:param include_archived_content: Whether to include archived content,
defaults to False
:type include_archived_content: bool, optional
:param include_attachments: defaults to False
:type include_attachments: bool, optional
:param attachment_filter_func: A function that takes the attachment information
from Confluence and decides whether or not the
attachment is processed.
:param include_comments: defaults to False
:type include_comments: bool, optional
:param content_format: Specify content format, defaults to
ContentFormat.STORAGE, the supported values are:
ContentFormat.EDITOR, ContentFormat.EXPORT_VIEW,
ContentFormat.ANONYMOUS_EXPORT_VIEW,
ContentFormat.STORAGE, and ContentFormat.VIEW.
:type content_format: ContentFormat
:param limit: Maximum number of pages to retrieve per request, defaults to 50
:type limit: int, optional
:param max_pages: Maximum number of pages to retrieve in total, defaults 1000
:type max_pages: int, optional
:param ocr_languages: The languages to use for the Tesseract agent. To use a
language, you'll first need to install the appropriate
Tesseract language pack.
:type ocr_languages: str, optional
:param keep_markdown_format: Whether to keep the markdown format, defaults to
False
:type keep_markdown_format: bool
:param keep_newlines: Whether to keep the newlines format, defaults to
False
:type keep_newlines: bool
:raises ValueError: Errors while validating input
:raises ImportError: Required dependencies not installed.