python-jira-plus 1.0.15__tar.gz → 2.0.1__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.15
3
+ Version: 2.0.1
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
@@ -119,7 +119,11 @@ class JiraPlus:
119
119
  jira_err_count: int = 3,
120
120
  json_result: bool = True,
121
121
  ) -> ResultList[Issue] | dict | None:
122
- return self._paginate_query(
122
+ if self.server_type == ServerType.ON_PREMISE:
123
+ _paginate_query_func = self._paginate_query
124
+ else:
125
+ _paginate_query_func = self._paginate_query_new
126
+ return _paginate_query_func(
123
127
  query=query,
124
128
  max_results=max_results,
125
129
  specific_fields=specific_fields,
@@ -127,6 +131,43 @@ class JiraPlus:
127
131
  json_result=json_result,
128
132
  )
129
133
 
134
+ def _paginate_query_new(
135
+ self,
136
+ query: str,
137
+ max_results: int,
138
+ specific_fields: str | list[str],
139
+ jira_err_limit: int,
140
+ json_result: bool,
141
+ ) -> ResultList[Issue] | list:
142
+ all_issues = []
143
+ retries = 0
144
+ page = None
145
+ while True: # pylint: disable=W0149
146
+ try:
147
+ self.logger.debug(f"Fetching issues from startAt={len(all_issues)}")
148
+ page = self.jira_client.enhanced_search_issues(
149
+ jql_str=query,
150
+ nextPageToken=page['nextPageToken'] if page else None,
151
+ maxResults=max_results,
152
+ fields=specific_fields,
153
+ json_result=json_result,
154
+ )
155
+ all_issues += page["issues"] if json_result else page
156
+ if page['isLast']:
157
+ break
158
+ retries = 0 # reset on success
159
+ except JIRAError as err:
160
+ if err.status_code == 400:
161
+ self.logger.error(f"Bad Request: {err.text}")
162
+ raise JIRAError(f"Bad Request: {err.text}") from err
163
+ retries += 1
164
+ self.logger.warning(f"Retry {retries}/{jira_err_limit} after JIRAError: {err}")
165
+ if retries >= jira_err_limit:
166
+ self.logger.exception("Max retries exceeded.")
167
+ return []
168
+ time.sleep(300 if retries == jira_err_limit - 1 else 90)
169
+ return all_issues
170
+
130
171
  def _paginate_query(
131
172
  self,
132
173
  query: str,
@@ -141,7 +182,7 @@ class JiraPlus:
141
182
  while True: # pylint: disable=W0149
142
183
  try:
143
184
  self.logger.debug(f"Fetching issues from startAt={start_at}")
144
- page = self.jira_client.search_issues(
185
+ page = self.jira_client.enhanced_search_issues(
145
186
  jql_str=query,
146
187
  startAt=start_at,
147
188
  maxResults=max_results,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-jira-plus
3
- Version: 1.0.15
3
+ Version: 2.0.1
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 find_packages, setup
2
2
 
3
- package_version = "1.0.15"
3
+ package_version = "2.0.1"
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."