diff --git a/llama-index-integrations/readers/llama-index-readers-jira/README.md b/llama-index-integrations/readers/llama-index-readers-jira/README.md index 2e76552ba9317..80d2c82fd5068 100644 --- a/llama-index-integrations/readers/llama-index-readers-jira/README.md +++ b/llama-index-integrations/readers/llama-index-readers-jira/README.md @@ -5,7 +5,7 @@ pip install llama-index-readers-jira ``` The Jira loader returns a set of issues based on the query provided to the dataloader. -We can follow two methods to initialize the loader- +We can follow three methods to initialize the loader- 1- basic_auth -> this takes a dict with the following keys `basic_auth:{ "email": "email", @@ -17,6 +17,11 @@ We can follow two methods to initialize the loader- "cloud_id": "cloud_id", "api_token": "token" }` +3- Personal access Token with Server hosted instance +`PATauth:{ +"server_url": "server_url", +"api_token": "token" +}` You can follow this link for more information regarding Oauth2 -> https://developer.atlassian.com/cloud/confluence/oauth-2-3lo-apps/ diff --git a/llama-index-integrations/readers/llama-index-readers-jira/llama_index/readers/jira/base.py b/llama-index-integrations/readers/llama-index-readers-jira/llama_index/readers/jira/base.py index 5ab0ef0a7f343..a74a6579fead7 100644 --- a/llama-index-integrations/readers/llama-index-readers-jira/llama_index/readers/jira/base.py +++ b/llama-index-integrations/readers/llama-index-readers-jira/llama_index/readers/jira/base.py @@ -15,6 +15,11 @@ class Oauth2(TypedDict): api_token: str +class PATauth(TypedDict): + server_url: str + api_token: str + + class JiraReader(BaseReader): """Jira reader. Reads data from Jira issues from passed query. @@ -28,6 +33,10 @@ class JiraReader(BaseReader): "cloud_id": "cloud_id", "api_token": "token" } + Optional patauth:{ + "server_url": "server_url", + "api_token": "token" + } """ def __init__( @@ -37,6 +46,7 @@ def __init__( server_url: Optional[str] = None, BasicAuth: Optional[BasicAuth] = None, Oauth2: Optional[Oauth2] = None, + PATauth: Optional[PATauth] = None, ) -> None: from jira import JIRA @@ -53,6 +63,12 @@ def __init__( "headers": {"Authorization": f"Bearer {Oauth2['api_token']}"}, } self.jira = JIRA(options=options) + elif PATauth: + options = { + "server": PATauth["server_url"], + "headers": {"Authorization": f"Bearer {PATauth['api_token']}"}, + } + self.jira = JIRA(options=options) else: self.jira = JIRA( basic_auth=(BasicAuth["email"], BasicAuth["api_token"]), diff --git a/llama-index-integrations/readers/llama-index-readers-jira/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-jira/pyproject.toml index 745a3d78efdca..c09dfc768da47 100644 --- a/llama-index-integrations/readers/llama-index-readers-jira/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-jira/pyproject.toml @@ -29,7 +29,7 @@ license = "MIT" maintainers = ["bearguy"] name = "llama-index-readers-jira" readme = "README.md" -version = "0.1.3" +version = "0.1.4" [tool.poetry.dependencies] python = ">=3.8.1,<4.0"