diff --git a/llama-index-integrations/readers/llama-index-readers-confluence/README.md b/llama-index-integrations/readers/llama-index-readers-confluence/README.md index 11ae8dbfed39b..618780ea07e1b 100644 --- a/llama-index-integrations/readers/llama-index-readers-confluence/README.md +++ b/llama-index-integrations/readers/llama-index-readers-confluence/README.md @@ -68,7 +68,11 @@ base_url = "https://yoursite.atlassian.com/wiki" page_ids = ["", "", " None: if base_url is None: raise ValueError("Must provide `base_url`") @@ -58,20 +60,30 @@ def __init__( " atlassian-python-api`" ) self.confluence: Confluence = None + if client_args is None: + client_args = {} if oauth2: - self.confluence = Confluence(url=base_url, oauth2=oauth2, cloud=cloud) + self.confluence = Confluence( + url=base_url, oauth2=oauth2, cloud=cloud, **client_args + ) else: if api_token is not None: - self.confluence = Confluence(url=base_url, token=api_token, cloud=cloud) + self.confluence = Confluence( + url=base_url, token=api_token, cloud=cloud, **client_args + ) elif user_name is not None and password is not None: self.confluence = Confluence( - url=base_url, username=user_name, password=password, cloud=cloud + url=base_url, + username=user_name, + password=password, + cloud=cloud, + **client_args, ) else: api_token = os.getenv(CONFLUENCE_API_TOKEN) if api_token is not None: self.confluence = Confluence( - url=base_url, token=api_token, cloud=cloud + url=base_url, token=api_token, cloud=cloud, **client_args ) else: user_name = os.getenv(CONFLUENCE_USERNAME) @@ -82,6 +94,7 @@ def __init__( username=user_name, password=password, cloud=cloud, + **client_args, ) else: raise ValueError( diff --git a/llama-index-integrations/readers/llama-index-readers-confluence/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-confluence/pyproject.toml index 21cb68aed91df..a85030add9e6a 100644 --- a/llama-index-integrations/readers/llama-index-readers-confluence/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-confluence/pyproject.toml @@ -28,7 +28,7 @@ license = "MIT" maintainers = ["zywilliamli"] name = "llama-index-readers-confluence" readme = "README.md" -version = "0.2.1" +version = "0.2.2" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" diff --git a/llama-index-integrations/readers/llama-index-readers-confluence/tests/test_readers_confluence.py b/llama-index-integrations/readers/llama-index-readers-confluence/tests/test_readers_confluence.py index 6a8d9d2b1e23b..8040a37515970 100644 --- a/llama-index-integrations/readers/llama-index-readers-confluence/tests/test_readers_confluence.py +++ b/llama-index-integrations/readers/llama-index-readers-confluence/tests/test_readers_confluence.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import pytest from llama_index.readers.confluence import ConfluenceReader @@ -31,6 +33,22 @@ def test_confluence_reader_with_api_token(): assert reader.confluence is not None +def test_confluence_reader_with_client_args(): + with patch("atlassian.Confluence") as MockConstructor: + reader = ConfluenceReader( + base_url="https://example.atlassian.net/wiki", + api_token="example_api_token", + client_args={"backoff_and_retry": True}, + ) + assert reader.confluence is not None + MockConstructor.assert_called_once_with( + url="https://example.atlassian.net/wiki", + token="example_api_token", + cloud=True, + backoff_and_retry=True, + ) + + def test_confluence_reader_with_basic_auth(): reader = ConfluenceReader( base_url="https://example.atlassian.net/wiki",