python-jira-plus 1.0.13__tar.gz → 1.0.14__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.13
3
+ Version: 1.0.14
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
@@ -7,6 +7,7 @@ import time
7
7
  from enum import Enum
8
8
  from typing import Any, Union, Optional
9
9
  import requests
10
+ from custom_python_logger import get_logger
10
11
  from jira import JIRA, JIRAError, Issue
11
12
  from jira.client import ResultList
12
13
  from retrying import retry
@@ -26,17 +27,17 @@ class ServerType(Enum):
26
27
 
27
28
  class JiraPlus:
28
29
  def __init__(
29
- self, base_url: Optional[str] = None,
30
- server_type: ServerType = ServerType.CLOUD,
31
- urllib3_log_level: int = logging.WARNING,
32
- jira_username: 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
30
+ self, base_url: Optional[str] = None,
31
+ server_type: ServerType = ServerType.CLOUD,
32
+ urllib3_log_level: int = logging.WARNING,
33
+ jira_username: Optional[str] = None,
34
+ jira_token: Optional[str] = None, # Use API token (not PAT)
35
+ verify_ssl: bool = True,
36
+ sso: bool = False,
37
+ url_scheme: UrlScheme = UrlScheme.HTTPS
37
38
  ) -> None:
38
- self.logger = logging.getLogger()
39
- logging.getLogger("urllib3").setLevel(urllib3_log_level)
39
+ self.logger = get_logger(self.__class__.__name__)
40
+ get_logger("urllib3").setLevel(urllib3_log_level)
40
41
 
41
42
  self.jira_username = jira_username or os.getenv('JIRA_USER_NAME')
42
43
  self.jira_token = jira_token or os.getenv('JIRA_TOKEN')
@@ -98,10 +99,10 @@ class JiraPlus:
98
99
  return False
99
100
 
100
101
  def get_issue_by_key(
101
- self,
102
- key: str,
103
- specific_fields: str | list[str] = '*all',
104
- json_result: bool = True
102
+ self,
103
+ key: str,
104
+ specific_fields: str | list[str] = '*all',
105
+ json_result: bool = True
105
106
  ) -> None | Issue | dict[str, Any]:
106
107
  try:
107
108
  jira_issue = self.jira_client.issue(id=key, fields=specific_fields)
@@ -116,12 +117,12 @@ class JiraPlus:
116
117
  return None
117
118
 
118
119
  def get_objects_by_query(
119
- self,
120
- query: str,
121
- max_results: int = 5000,
122
- specific_fields: Union[str, list[str]] = "*all",
123
- jira_err_count: int = 3,
124
- json_result: bool = True,
120
+ self,
121
+ query: str,
122
+ max_results: int = 5000,
123
+ specific_fields: Union[str, list[str]] = "*all",
124
+ jira_err_count: int = 3,
125
+ json_result: bool = True,
125
126
  ) -> Optional[Union[ResultList[Issue], dict]]:
126
127
  return self._paginate_query(
127
128
  query=query,
@@ -132,12 +133,12 @@ class JiraPlus:
132
133
  )
133
134
 
134
135
  def _paginate_query(
135
- self,
136
- query: str,
137
- max_results: int,
138
- specific_fields: Union[str, list[str]],
139
- jira_err_limit: int,
140
- json_result: bool
136
+ self,
137
+ query: str,
138
+ max_results: int,
139
+ specific_fields: Union[str, list[str]],
140
+ jira_err_limit: int,
141
+ json_result: bool
141
142
  ) -> Union[ResultList[Issue] | list]:
142
143
  start_at = 0
143
144
  all_issues = []
@@ -192,10 +193,10 @@ class JiraPlus:
192
193
  return meta, issue_meta
193
194
 
194
195
  def get_allowed_values(
195
- self,
196
- project_key: str,
197
- issue_type: str,
198
- field_id_or_name: str,
196
+ self,
197
+ project_key: str,
198
+ issue_type: str,
199
+ field_id_or_name: str,
199
200
  ) -> Optional[list]:
200
201
  """
201
202
  Returns the allowed values for a specific field in a project + issue type context.
@@ -255,10 +256,10 @@ class JiraPlus:
255
256
  return {f.fieldId: f.raw for f in field_list}
256
257
 
257
258
  def validate_fields(
258
- self,
259
- project_key: str,
260
- issue_type: str,
261
- fields: Optional[dict] = None
259
+ self,
260
+ project_key: str,
261
+ issue_type: str,
262
+ fields: Optional[dict] = None
262
263
  ) -> None:
263
264
  fields_metadata = self.get_project_fields_metadata(
264
265
  project_key=project_key,
@@ -293,13 +294,13 @@ class JiraPlus:
293
294
  # Add more field type checks as needed
294
295
 
295
296
  def create_issue(
296
- self,
297
- project_key: str,
298
- summary: str,
299
- description: str,
300
- issue_type: str,
301
- assignee: Optional[str] = None,
302
- custom_fields: Optional[dict] = None,
297
+ self,
298
+ project_key: str,
299
+ summary: str,
300
+ description: str,
301
+ issue_type: str,
302
+ assignee: Optional[str] = None,
303
+ custom_fields: Optional[dict] = None,
303
304
  ) -> Optional[Issue]:
304
305
  issue_fields = {
305
306
  "project": {"key": project_key},
@@ -320,9 +321,9 @@ class JiraPlus:
320
321
  return issue
321
322
 
322
323
  def update_issue(
323
- self,
324
- issue_key: str,
325
- fields_to_update: dict
324
+ self,
325
+ issue_key: str,
326
+ fields_to_update: dict
326
327
  ) -> Optional[Issue]:
327
328
  try:
328
329
  issue = self.jira_client.issue(issue_key)
@@ -395,11 +396,11 @@ class JiraPlus:
395
396
  self.logger.exception(f"Exception - Attachment {file_path} was not uploaded to issue {issue_key}\n{err}")
396
397
 
397
398
  def transition_issue(
398
- self,
399
- issue_key: str,
400
- transition_name: str,
401
- fields: Optional[dict] = None,
402
- comment: Optional[str] = None,
399
+ self,
400
+ issue_key: str,
401
+ transition_name: str,
402
+ fields: Optional[dict] = None,
403
+ comment: Optional[str] = None,
403
404
  ) -> bool:
404
405
  try:
405
406
  transitions = self.jira_client.transitions(issue_key)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-jira-plus
3
- Version: 1.0.13
3
+ Version: 1.0.14
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.13'
3
+ package_version = '1.0.14'
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.'