brynq-sdk-jira 3.0.0__tar.gz → 3.0.2__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: 1.0
2
2
  Name: brynq_sdk_jira
3
- Version: 3.0.0
3
+ Version: 3.0.2
4
4
  Summary: JIRA wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -26,42 +26,60 @@ class Jira(BrynQ):
26
26
  :param expand_fields: an optional list of fields to expand
27
27
  :return: dataframe with issues
28
28
  """
29
- total_response = []
30
- got_all_results = False
31
- no_of_loops = 0
32
- while not got_all_results:
33
- query = {
34
- 'startAt': f'{100 * no_of_loops}',
35
- 'maxResults': '100',
36
- 'fields': ["summary", "issuetype", "timetracking", "timespent", "description", "assignee", "project"],
37
- 'fieldsByKeys': 'false'
29
+ if jira_filter_id is not None:
30
+ raise ValueError("Jira filter id is no longer supported, use jql_filter instead")
31
+
32
+ # Use new JQL search endpoint
33
+ url = f"{self.base_url}rest/api/3/search/jql"
34
+
35
+ all_issues = []
36
+ next_page_token = None
37
+
38
+ while True:
39
+ payload = {
40
+ "maxResults": 100,
41
+ "fields": ["summary", "issuetype", "timetracking", "timespent", "description", "assignee", "project"]
38
42
  }
43
+
44
+ if jql_filter:
45
+ payload["jql"] = jql_filter
46
+
47
+ if get_extra_fields:
48
+ payload["fields"].extend(get_extra_fields)
49
+
50
+ if expand_fields:
51
+ # Convert list to comma-delimited string
52
+ payload["expand"] = ",".join(expand_fields)
53
+
54
+ if next_page_token:
55
+ payload["nextPageToken"] = next_page_token
56
+
39
57
  if self.debug:
40
- print(query)
41
- if jql_filter is not None:
42
- query['jql'] = jql_filter
43
- if get_extra_fields is not None:
44
- query['fields'] += get_extra_fields
45
- if expand_fields is not None:
46
- query['expand'] = expand_fields
47
- if jira_filter_id is not None:
48
- url = f"{self.base_url}rest/api/3/search/jira/filter/{jira_filter_id}"
49
- else:
50
- url = f"{self.base_url}rest/api/3/search"
51
- response = requests.post(url=url, headers=self.headers, data=json.dumps(query), timeout=self.timeout)
58
+ print(f"Payload: {payload}")
59
+
60
+ response = requests.post(
61
+ url=url,
62
+ headers=self.headers,
63
+ data=json.dumps(payload),
64
+ timeout=self.timeout
65
+ )
66
+
52
67
  if response.status_code == 200:
53
68
  response_json = response.json()
54
- no_of_loops += 1
55
- got_all_results = False if len(response_json['issues']) == 100 else True
56
- total_response += response_json['issues']
69
+ all_issues.extend(response_json.get("issues", []))
70
+
71
+ # Check for next page
72
+ if "nextPageToken" in response_json:
73
+ next_page_token = response_json["nextPageToken"]
74
+ else:
75
+ break
57
76
  else:
58
77
  raise ConnectionError(f"Error getting issues from Jira with message: {response.status_code, response.text}")
59
78
 
60
79
  if self.debug:
61
- print(f"Received {len(total_response)} issues from Jira")
62
-
63
- df = pd.json_normalize(total_response)
80
+ print(f"Received {len(all_issues)} issues from Jira")
64
81
 
82
+ df = pd.json_normalize(all_issues)
65
83
  return df
66
84
 
67
85
  def get_projects(self) -> pd.DataFrame:
@@ -143,4 +161,4 @@ class Jira(BrynQ):
143
161
  print(f"Received {len(all_users)} jira users from Jira")
144
162
 
145
163
  df = pd.json_normalize(all_users)
146
- return df
164
+ return df
@@ -9,7 +9,7 @@ class Tempo(BrynQ):
9
9
  def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug=False):
10
10
  super().__init__()
11
11
  self.debug = debug
12
- credentials = self.interfaces.credentials.get(system="tempo-timesheets", system_type=system_type)
12
+ credentials = self.interfaces.credentials.get(system="jira", system_type=system_type)
13
13
  credentials = credentials.get('data')
14
14
  self.headers = {
15
15
  "Authorization": f"Bearer {credentials['api_token']}",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-jira
3
- Version: 3.0.0
3
+ Version: 3.0.2
4
4
  Summary: JIRA wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name='brynq_sdk_jira',
5
- version='3.0.0',
5
+ version='3.0.2',
6
6
  description='JIRA wrapper from BrynQ',
7
7
  long_description='JIRA wrapper from BrynQ',
8
8
  author='BrynQ',
@@ -15,4 +15,4 @@ setup(
15
15
  'requests>=2,<=3'
16
16
  ],
17
17
  zip_safe=False,
18
- )
18
+ )
File without changes