python-jira-plus 1.0.3__tar.gz → 1.0.4__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.3/python_jira_plus.egg-info → python_jira_plus-1.0.4}/PKG-INFO +1 -1
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus/jira_plus.py +50 -50
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4/python_jira_plus.egg-info}/PKG-INFO +1 -1
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/setup.py +1 -1
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/LICENSE +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/MANIFEST.in +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/README.md +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/pyproject.toml +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus/__init__.py +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus/describe_allowed_value.py +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus.egg-info/SOURCES.txt +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus.egg-info/dependency_links.txt +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus.egg-info/requires.txt +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus.egg-info/top_level.txt +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/requirements.txt +0 -0
- {python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/setup.cfg +0 -0
|
@@ -21,18 +21,18 @@ class ServerType(Enum):
|
|
|
21
21
|
|
|
22
22
|
class JiraPlus:
|
|
23
23
|
def __init__(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
self, base_url: Optional[str] = None,
|
|
25
|
+
server_type: ServerType = ServerType.CLOUD,
|
|
26
|
+
urllib3_log_level: int = logging.WARNING,
|
|
27
|
+
jira_username: Optional[str] = None,
|
|
28
|
+
jira_token: Optional[str] = None
|
|
27
29
|
) -> None:
|
|
28
30
|
self.logger = logging.getLogger()
|
|
29
31
|
logging.getLogger("urllib3").setLevel(urllib3_log_level)
|
|
30
32
|
|
|
31
|
-
self.jira_username = os.getenv('JIRA_USER_NAME')
|
|
32
|
-
self.jira_token = os.getenv('JIRA_TOKEN')
|
|
33
|
-
|
|
34
|
-
if not base_url:
|
|
35
|
-
self.base_url = os.getenv('JIRA_BASE_URL')
|
|
33
|
+
self.jira_username = jira_username or os.getenv('JIRA_USER_NAME')
|
|
34
|
+
self.jira_token = jira_token or os.getenv('JIRA_TOKEN')
|
|
35
|
+
self.base_url = base_url or os.getenv('JIRA_BASE_URL')
|
|
36
36
|
|
|
37
37
|
self.server_type = server_type
|
|
38
38
|
self.server = f'https://{self.base_url}'
|
|
@@ -40,8 +40,7 @@ class JiraPlus:
|
|
|
40
40
|
self.jira_client = self.create_connection()
|
|
41
41
|
self.check_client_connection()
|
|
42
42
|
|
|
43
|
-
@retry(stop_max_attempt_number=3,
|
|
44
|
-
wait_fixed=180000) # Retry 3 times with a 3-min (180000) delay between each attempt
|
|
43
|
+
@retry(stop_max_attempt_number=3, wait_fixed=180000) # Retry 3 times with a 3-min (180000) delay between each attempt
|
|
45
44
|
def create_connection(self) -> Optional[JIRA]:
|
|
46
45
|
jira_client = JIRA(
|
|
47
46
|
basic_auth=(self.jira_username, self.jira_token),
|
|
@@ -81,10 +80,10 @@ class JiraPlus:
|
|
|
81
80
|
return False
|
|
82
81
|
|
|
83
82
|
def get_issue_by_key(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
self,
|
|
84
|
+
key: str,
|
|
85
|
+
specific_fields: str | list[str] = '*all',
|
|
86
|
+
json_result: bool = True
|
|
88
87
|
) -> None | Issue | dict[str, Any]:
|
|
89
88
|
try:
|
|
90
89
|
jira_issue = self.jira_client.issue(id=key, fields=specific_fields)
|
|
@@ -99,12 +98,12 @@ class JiraPlus:
|
|
|
99
98
|
return None
|
|
100
99
|
|
|
101
100
|
def get_objects_by_query(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
self,
|
|
102
|
+
query: str,
|
|
103
|
+
max_results: int = 5000,
|
|
104
|
+
specific_fields: Union[str, list[str]] = "*all",
|
|
105
|
+
jira_err_count: int = 3,
|
|
106
|
+
json_result: bool = True,
|
|
108
107
|
) -> Optional[Union[ResultList[Issue], dict]]:
|
|
109
108
|
return self._paginate_query(
|
|
110
109
|
query=query,
|
|
@@ -115,12 +114,12 @@ class JiraPlus:
|
|
|
115
114
|
)
|
|
116
115
|
|
|
117
116
|
def _paginate_query(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
self,
|
|
118
|
+
query: str,
|
|
119
|
+
max_results: int,
|
|
120
|
+
specific_fields: Union[str, list[str]],
|
|
121
|
+
jira_err_limit: int,
|
|
122
|
+
json_result: bool
|
|
124
123
|
) -> Union[ResultList[Issue] | list]:
|
|
125
124
|
start_at = 0
|
|
126
125
|
all_issues = []
|
|
@@ -172,10 +171,10 @@ class JiraPlus:
|
|
|
172
171
|
return meta, issue_meta
|
|
173
172
|
|
|
174
173
|
def get_allowed_values(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
self,
|
|
175
|
+
project_key: str,
|
|
176
|
+
issue_type: str,
|
|
177
|
+
field_id_or_name: str,
|
|
179
178
|
) -> Optional[list]:
|
|
180
179
|
"""
|
|
181
180
|
Returns the allowed values for a specific field in a project + issue type context.
|
|
@@ -209,10 +208,10 @@ class JiraPlus:
|
|
|
209
208
|
return describe_allowed_value(value, allowed_values=allowed_values)
|
|
210
209
|
|
|
211
210
|
def validate_fields(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
self,
|
|
212
|
+
project_key: str,
|
|
213
|
+
issue_type: str,
|
|
214
|
+
fields: Optional[dict] = None
|
|
216
215
|
) -> None:
|
|
217
216
|
meta, issue_meta = self._fetch_metadata(project_key=project_key, issue_type=issue_type)
|
|
218
217
|
field_types = meta['projects'][0]['issuetypes'][0]['fields']
|
|
@@ -246,13 +245,13 @@ class JiraPlus:
|
|
|
246
245
|
return issue_meta['fields'].keys()
|
|
247
246
|
|
|
248
247
|
def create_issue(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
248
|
+
self,
|
|
249
|
+
project_key: str,
|
|
250
|
+
summary: str,
|
|
251
|
+
description: str,
|
|
252
|
+
issue_type: str,
|
|
253
|
+
assignee: Optional[str] = None,
|
|
254
|
+
custom_fields: Optional[dict] = None,
|
|
256
255
|
) -> Optional[Issue]:
|
|
257
256
|
issue_fields = {
|
|
258
257
|
"project": {"key": project_key},
|
|
@@ -261,7 +260,8 @@ class JiraPlus:
|
|
|
261
260
|
"description": description,
|
|
262
261
|
}
|
|
263
262
|
if assignee:
|
|
264
|
-
issue_fields["assignee"] = {"accountId": assignee} if self.server_type == ServerType.CLOUD else {
|
|
263
|
+
issue_fields["assignee"] = {"accountId": assignee} if self.server_type == ServerType.CLOUD else {
|
|
264
|
+
"name": assignee}
|
|
265
265
|
|
|
266
266
|
if custom_fields:
|
|
267
267
|
issue_fields = issue_fields | custom_fields
|
|
@@ -279,9 +279,9 @@ class JiraPlus:
|
|
|
279
279
|
return None
|
|
280
280
|
|
|
281
281
|
def update_issue(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
self,
|
|
283
|
+
issue_key: str,
|
|
284
|
+
fields_to_update: dict
|
|
285
285
|
) -> Optional[Issue]:
|
|
286
286
|
try:
|
|
287
287
|
issue = self.jira_client.issue(issue_key)
|
|
@@ -350,11 +350,11 @@ class JiraPlus:
|
|
|
350
350
|
self.logger.exception(f"Exception - Attachment {file_path} was not uploaded to issue {issue_key}\n{err}")
|
|
351
351
|
|
|
352
352
|
def transition_issue(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
self,
|
|
354
|
+
issue_key: str,
|
|
355
|
+
transition_name: str,
|
|
356
|
+
fields: Optional[dict] = None,
|
|
357
|
+
comment: Optional[str] = None,
|
|
358
358
|
) -> bool:
|
|
359
359
|
try:
|
|
360
360
|
transitions = self.jira_client.transitions(issue_key)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus/describe_allowed_value.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_jira_plus-1.0.3 → python_jira_plus-1.0.4}/python_jira_plus.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|