-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]: ConfluenceReader base url #13783
Comments
Hello @ricardoxu6! I'm here to help you with any bugs, questions, or contributions you may have. Let's tackle this ConfluenceReader base url issue together. Yes, you can use Here is the relevant part of the code that shows how the class ConfluenceReader(BaseReader):
"""Confluence reader.
Reads a set of confluence pages given a space key and optionally a list of page ids
Args:
oauth2 (dict): Atlassian OAuth 2.0, minimum fields are `client_id` and `token`, where `token` is a dict and must at least contain "access_token" and "token_type".
base_url (str): 'base_url' for confluence cloud instance, this is suffixed with '/wiki', eg 'https://yoursite.atlassian.com/wiki'
cloud (bool): connecting to Confluence Cloud or self-hosted instance
"""
def __init__(
self, base_url: str = None, oauth2: Optional[Dict] = None, cloud: bool = True
) -> None:
if base_url is None:
raise ValueError("Must provide `base_url`")
self.base_url = base_url
try:
from atlassian import Confluence
except ImportError:
raise ImportError(
"`atlassian` package not found, please run `pip install"
" atlassian-python-api`"
)
self.confluence: Confluence = None
if oauth2:
self.confluence = Confluence(url=base_url, oauth2=oauth2, cloud=cloud)
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)
else:
user_name = os.getenv(CONFLUENCE_USERNAME)
if user_name is None:
raise ValueError(
"Must set environment variable `CONFLUENCE_USERNAME` if oauth,"
" oauth2, or `CONFLUENCE_API_TOKEN` are not provided."
)
password = os.getenv(CONFLUENCE_PASSWORD)
if password is None:
raise ValueError(
"Must set environment variable `CONFLUENCE_PASSWORD` if oauth,"
" oauth2, or `CONFLUENCE_API_TOKEN` are not provided."
)
self.confluence = Confluence(
url=base_url, username=user_name, password=password, cloud=cloud
) As long as you provide a valid
|
What if for my custom domain, those confluence pages' URLs do not have a page_id included in the url, can I still use the Confluence Reader |
Yes, you can use the
|
Question Validation
Question
token = {"access_token": "<access_token>", "token_type": "<token_type>"}
oauth2_dict = {"client_id": "<client_id>", "token": token}
base_url = "https://yoursite.atlassian.com/wiki"
To use Confluence Reader to read pages on Confluence, it needs us to specify a base URL and the URL should be in the typical format of Atlassian Cloud, which ends with /wiki. So, if my Confluence is hosted on a custom domain, for instance, https://confluence.xxx.com/, is there any other way for us to use Confluence Reader?
The text was updated successfully, but these errors were encountered: