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.
- {python_jira_plus-1.0.4/python_jira_plus.egg-info → python_jira_plus-1.0.6}/PKG-INFO +1 -1
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus/jira_plus.py +26 -8
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6/python_jira_plus.egg-info}/PKG-INFO +1 -1
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/setup.py +1 -1
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/LICENSE +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/MANIFEST.in +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/README.md +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/pyproject.toml +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus/__init__.py +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus/describe_allowed_value.py +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus.egg-info/SOURCES.txt +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus.egg-info/dependency_links.txt +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus.egg-info/requires.txt +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus.egg-info/top_level.txt +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/requirements.txt +0 -0
- {python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/setup.cfg +0 -0
|
@@ -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'
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus/describe_allowed_value.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_jira_plus-1.0.4 → python_jira_plus-1.0.6}/python_jira_plus.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|