python-jira-plus 1.0.4__tar.gz → 1.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-jira-plus
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Enhanced Python client for JIRA with better error handling, pagination, and metadata validation.
5
5
  Home-page: https://github.com/aviz92/python-jira-plus
6
6
  Author: Avi Zaguri
@@ -14,6 +14,11 @@ from retrying import retry
14
14
  from python_jira_plus.describe_allowed_value import describe_allowed_value
15
15
 
16
16
 
17
+ class UrlScheme(Enum):
18
+ HTTP = 'http'
19
+ HTTPS = 'https'
20
+
21
+
17
22
  class ServerType(Enum):
18
23
  CLOUD = 'cloud'
19
24
  ON_PREMISE = 'on_premise'
@@ -25,7 +30,10 @@ class JiraPlus:
25
30
  server_type: ServerType = ServerType.CLOUD,
26
31
  urllib3_log_level: int = logging.WARNING,
27
32
  jira_username: Optional[str] = None,
28
- jira_token: Optional[str] = None
33
+ jira_token: Optional[str] = None, # Use API token (not PAT)
34
+ verify_ssl: bool = True,
35
+ sso: bool = False,
36
+ url_scheme: UrlScheme = UrlScheme.HTTPS
29
37
  ) -> None:
30
38
  self.logger = logging.getLogger()
31
39
  logging.getLogger("urllib3").setLevel(urllib3_log_level)
@@ -33,20 +41,30 @@ class JiraPlus:
33
41
  self.jira_username = jira_username or os.getenv('JIRA_USER_NAME')
34
42
  self.jira_token = jira_token or os.getenv('JIRA_TOKEN')
35
43
  self.base_url = base_url or os.getenv('JIRA_BASE_URL')
44
+ self.url_scheme = url_scheme.value
36
45
 
37
46
  self.server_type = server_type
38
- self.server = f'https://{self.base_url}'
47
+ self.server = f'{self.url_scheme}://{self.base_url}'
48
+ self.verify_ssl = verify_ssl
49
+ self.sso = sso
39
50
 
40
51
  self.jira_client = self.create_connection()
41
52
  self.check_client_connection()
42
53
 
43
54
  @retry(stop_max_attempt_number=3, wait_fixed=180000) # Retry 3 times with a 3-min (180000) delay between each attempt
44
- def create_connection(self) -> Optional[JIRA]:
45
- jira_client = JIRA(
46
- basic_auth=(self.jira_username, self.jira_token),
47
- options={'server': self.server},
48
- timeout=580
49
- )
55
+ def create_connection(self, timeout=580) -> Optional[JIRA]:
56
+ if self.server_type == ServerType.ON_PREMISE and not self.sso:
57
+ jira_client = JIRA(
58
+ token_auth=self.jira_token,
59
+ options={'server': self.server, 'verify': self.verify_ssl},
60
+ timeout=timeout
61
+ )
62
+ else:
63
+ jira_client = JIRA(
64
+ basic_auth=(self.jira_username, self.jira_token),
65
+ options={'server': self.server, 'verify': self.verify_ssl},
66
+ timeout=timeout
67
+ )
50
68
 
51
69
  if jira_client.projects():
52
70
  self.logger.info(f"Jira Connection Successful")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-jira-plus
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Enhanced Python client for JIRA with better error handling, pagination, and metadata validation.
5
5
  Home-page: https://github.com/aviz92/python-jira-plus
6
6
  Author: Avi Zaguri
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- package_version = '1.0.4'
3
+ package_version = '1.0.6'
4
4
 
5
5
  package_name = 'python-jira-plus'
6
6
  package_description = 'Enhanced Python client for JIRA with better error handling, pagination, and metadata validation.'