atlassian-python-api 3.41.15__py3-none-any.whl → 3.41.16__py3-none-any.whl

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.
atlassian/VERSION CHANGED
@@ -1 +1 @@
1
- 3.41.15
1
+ 3.41.16
atlassian/confluence.py CHANGED
@@ -522,13 +522,14 @@ class Confluence(AtlassianRestAPI):
522
522
  # operate differently between different collaborative modes
523
523
  return self.get_page_by_id(page_id=page_id, expand=expand, status=status)
524
524
 
525
- def get_all_pages_by_label(self, label, start=0, limit=50):
525
+ def get_all_pages_by_label(self, label, start=0, limit=50, expand=None):
526
526
  """
527
527
  Get all page by label
528
528
  :param label:
529
529
  :param start: OPTIONAL: The start point of the collection to return. Default: None (0).
530
530
  :param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
531
531
  fixed system limits. Default: 50
532
+ :param expand: OPTIONAL: a comma separated list of properties to expand on the content
532
533
  :return:
533
534
  """
534
535
  url = "rest/api/content/search"
@@ -539,6 +540,8 @@ class Confluence(AtlassianRestAPI):
539
540
  params["start"] = start
540
541
  if limit:
541
542
  params["limit"] = limit
543
+ if expand:
544
+ params["expand"] = expand
542
545
 
543
546
  try:
544
547
  response = self.get(url, params=params)
@@ -793,6 +796,7 @@ class Confluence(AtlassianRestAPI):
793
796
  representation="storage",
794
797
  editor=None,
795
798
  full_width=False,
799
+ status="current",
796
800
  ):
797
801
  """
798
802
  Create page from scratch
@@ -804,6 +808,7 @@ class Confluence(AtlassianRestAPI):
804
808
  :param representation: OPTIONAL: either Confluence 'storage' or 'wiki' markup format
805
809
  :param editor: OPTIONAL: v2 to be created in the new editor
806
810
  :param full_width: DEFAULT: False
811
+ :param status: either 'current' or 'draft'
807
812
  :return:
808
813
  """
809
814
  log.info('Creating %s "%s" -> "%s"', type, space, title)
@@ -811,6 +816,7 @@ class Confluence(AtlassianRestAPI):
811
816
  data = {
812
817
  "type": type,
813
818
  "title": title,
819
+ "status": status,
814
820
  "space": {"key": space},
815
821
  "body": self._create_body(body, representation),
816
822
  "metadata": {"properties": {}},
@@ -1211,7 +1217,8 @@ class Confluence(AtlassianRestAPI):
1211
1217
  :type name: ``str``
1212
1218
  :param content: Contains the content which should be uploaded
1213
1219
  :type content: ``binary``
1214
- :param content_type: Specify the HTTP content type. The default is
1220
+ :param content_type: Specify the HTTP content type.
1221
+ The default is "application/binary"
1215
1222
  :type content_type: ``str``
1216
1223
  :param comment: A comment describing this upload/file
1217
1224
  :type comment: ``str``
@@ -1293,6 +1300,7 @@ class Confluence(AtlassianRestAPI):
1293
1300
  Is no name give the file name is used as name
1294
1301
  :type name: ``str``
1295
1302
  :param content_type: Specify the HTTP content type. The default is
1303
+ The default is "application/binary"
1296
1304
  :type content_type: ``str``
1297
1305
  :param comment: A comment describing this upload/file
1298
1306
  :type comment: ``str``
atlassian/jira.py CHANGED
@@ -1232,7 +1232,7 @@ class Jira(AtlassianRestAPI):
1232
1232
  return self.get(url, params=params)
1233
1233
  else:
1234
1234
  url = "{base_url}/{issue_key}?expand=changelog".format(base_url=base_url, issue_key=issue_key)
1235
- return (self.get(url) or {}).get("changelog", params)
1235
+ return self._get_response_content(url, fields=[("changelog", params)])
1236
1236
 
1237
1237
  def issue_add_json_worklog(self, key, worklog):
1238
1238
  """
@@ -1378,7 +1378,7 @@ class Jira(AtlassianRestAPI):
1378
1378
  url = "{base_url}/{issue_key}?fields=labels".format(base_url=base_url, issue_key=issue_key)
1379
1379
  if self.advanced_mode:
1380
1380
  return self.get(url)
1381
- return (self.get(url) or {}).get("fields").get("labels")
1381
+ return self._get_response_content(url, fields=[("fields",), ("labels",)])
1382
1382
 
1383
1383
  def update_issue(self, issue_key, update):
1384
1384
  """
@@ -1919,12 +1919,14 @@ class Jira(AtlassianRestAPI):
1919
1919
  def get_issue_status(self, issue_key):
1920
1920
  base_url = self.resource_url("issue")
1921
1921
  url = "{base_url}/{issue_key}?fields=status".format(base_url=base_url, issue_key=issue_key)
1922
- return (((self.get(url) or {}).get("fields") or {}).get("status") or {}).get("name") or {}
1922
+ fields = [("fields",), ("status",), ("name",)]
1923
+ return self._get_response_content(url, fields=fields) or {}
1923
1924
 
1924
1925
  def get_issue_status_id(self, issue_key):
1925
1926
  base_url = self.resource_url("issue")
1926
1927
  url = "{base_url}/{issue_key}?fields=status".format(base_url=base_url, issue_key=issue_key)
1927
- return (self.get(url) or {}).get("fields").get("status").get("id")
1928
+ fields = [("fields",), ("status",), ("id",)]
1929
+ return self._get_response_content(url, fields=fields)
1928
1930
 
1929
1931
  def get_issue_transitions_full(self, issue_key, transition_id=None, expand=None):
1930
1932
  """
@@ -2721,7 +2723,7 @@ class Jira(AtlassianRestAPI):
2721
2723
  """
2722
2724
  base_url = self.resource_url("project")
2723
2725
  url = "{base_url}/{projectIdOrKey}/role/{id}".format(base_url=base_url, projectIdOrKey=project_key, id=role_id)
2724
- return (self.get(url) or {}).get("actors")
2726
+ return self._get_response_content(url, fields=[("actors",)])
2725
2727
 
2726
2728
  def delete_project_actors(self, project_key, role_id, actor, actor_type=None):
2727
2729
  """
@@ -3080,7 +3082,7 @@ class Jira(AtlassianRestAPI):
3080
3082
  def get_status_id_from_name(self, status_name):
3081
3083
  base_url = self.resource_url("status")
3082
3084
  url = "{base_url}/{name}".format(base_url=base_url, name=status_name)
3083
- return int((self.get(url) or {}).get("id"))
3085
+ return int(self._get_response_content(url, fields=[("id",)]))
3084
3086
 
3085
3087
  def get_status_for_project(self, project_key):
3086
3088
  base_url = self.resource_url("project")
@@ -3181,7 +3183,7 @@ class Jira(AtlassianRestAPI):
3181
3183
  a name and a label for the outward and inward link relationship.
3182
3184
  """
3183
3185
  url = self.resource_url("issueLinkType")
3184
- return (self.get(url) or {}).get("issueLinkTypes")
3186
+ return self._get_response_content(url, fields=[("issueLinkTypes",)])
3185
3187
 
3186
3188
  def get_issue_link_types_names(self):
3187
3189
  """
@@ -3712,7 +3714,7 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
3712
3714
  params = {}
3713
3715
  if expand:
3714
3716
  params["expand"] = expand
3715
- return (self.get(url, params=params) or {}).get("permissionSchemes")
3717
+ return self._get_response_content(url, params=params, fields=[("permissionSchemes",)])
3716
3718
 
3717
3719
  def get_permissionscheme(self, permission_id, expand=None):
3718
3720
  """
@@ -3768,7 +3770,7 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
3768
3770
  :return: list
3769
3771
  """
3770
3772
  url = self.resource_url("issuesecurityschemes")
3771
- return self.get(url).get("issueSecuritySchemes")
3773
+ return self._get_response_content(url, fields=[("issueSecuritySchemes",)])
3772
3774
 
3773
3775
  def get_issue_security_scheme(self, scheme_id, only_levels=False):
3774
3776
  """
@@ -3785,7 +3787,7 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
3785
3787
  url = "{base_url}/{scheme_id}".format(base_url=base_url, scheme_id=scheme_id)
3786
3788
 
3787
3789
  if only_levels is True:
3788
- return self.get(url).get("levels")
3790
+ return self._get_response_content(url, fields=[("levels",)])
3789
3791
  else:
3790
3792
  return self.get(url)
3791
3793
 
atlassian/rest_client.py CHANGED
@@ -362,6 +362,34 @@ class AtlassianRestAPI(object):
362
362
  log.error(e)
363
363
  return response.text
364
364
 
365
+ def _get_response_content(
366
+ self,
367
+ *args,
368
+ fields,
369
+ **kwargs,
370
+ ):
371
+ """
372
+ :param fields: list of tuples in the form (field_name, default value (optional)).
373
+ Used for chaining dictionary value accession.
374
+ E.g. [("field1", "default1"), ("field2", "default2"), ("field3", )]
375
+ """
376
+ response = self.get(*args, **kwargs)
377
+ if "advanced_mode" in kwargs:
378
+ advanced_mode = kwargs["advanced_mode"]
379
+ else:
380
+ advanced_mode = self.advanced_mode
381
+
382
+ if not advanced_mode: # dict
383
+ for field in fields:
384
+ response = response.get(*field)
385
+ else: # requests.Response
386
+ first_field = fields[0]
387
+ response = response.json().get(*first_field)
388
+ for field in fields[1:]:
389
+ response = response.get(*field)
390
+
391
+ return response
392
+
365
393
  def post(
366
394
  self,
367
395
  path,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atlassian-python-api
3
- Version: 3.41.15
3
+ Version: 3.41.16
4
4
  Summary: Python Atlassian REST API Wrapper
5
5
  Home-page: https://github.com/atlassian-api/atlassian-python-api
6
6
  Download-URL: https://github.com/atlassian-api/atlassian-python-api
@@ -1,16 +1,16 @@
1
- atlassian/VERSION,sha256=RJ_VCwbjh_nVAQg_AsjMCLcKveJAo0IYu_2kXj5_DIs,8
1
+ atlassian/VERSION,sha256=1hYTE8saoXK8AP1qP-CHhjALZNefomLO5iM3Dmx94jo,8
2
2
  atlassian/__init__.py,sha256=F13CZFoWIj9pDkj83soA7hwwHtvDC6EqFATey9p36PM,768
3
3
  atlassian/bamboo.py,sha256=uPpmwkHQ_RiM8BkZvPunl6n1RnpEflKIS9AefZd5ne8,48969
4
4
  atlassian/cloud_admin.py,sha256=vZxMA6IrdCQw1KAX3xKal_0ayTWGdMVhe3i0bPpChGk,969
5
- atlassian/confluence.py,sha256=0ngO1AuF67g8ng6Uy5wy53YF2PILFB2zcv8wi1jIBWM,122479
5
+ atlassian/confluence.py,sha256=ah0PUrVNZKtGGSXfnl3raAovG5SIN66b8QGsfIgvTWw,122852
6
6
  atlassian/crowd.py,sha256=owgIavDgS5vnPEx-AiBi0mLa2DKV0jKW381vn0uLMfM,9556
7
7
  atlassian/errors.py,sha256=GAKr6W4zPn7ZUMRLHG8-UgAdVnxDzKVZ-jyGXAccALE,398
8
8
  atlassian/insight.py,sha256=oOWYoIway05rNup5GPDRm3S5WYuDhHe7JJ-g3vNccsk,23798
9
- atlassian/jira.py,sha256=27yY6cr-aPabG3vzDw6SczRxeSi5aJg3jR_zR7ZoASg,209781
9
+ atlassian/jira.py,sha256=wHwScqxqypeSQPvGk4ThPWiKwZPw3MzQ2e3BSDto9js,210003
10
10
  atlassian/marketplace.py,sha256=-y7j0mOi00gBzq1Izj-sXI8khP90rKJUYXijpKW9vs8,2590
11
11
  atlassian/portfolio.py,sha256=ioJMyxJW_Uuitszzd0ExoF1t8tykdit7Z7-WYlI6raA,3807
12
12
  atlassian/request_utils.py,sha256=HRqGJyeWS3L3SAlgC2x8tKakvyHb1HafxcrHhTNq9iE,1127
13
- atlassian/rest_client.py,sha256=vmAqgNeU-pFQJy5Q6vQs9BEgPftoQdhvTcuMjJGeJbA,18685
13
+ atlassian/rest_client.py,sha256=fT9_GHZlHqEp-LtIQrUHOqmAyuMqWASWS_weE4DuuV0,19593
14
14
  atlassian/service_desk.py,sha256=VwKzAWYumm7GsHTNo8l6FlzxF5CNXmL_6Fg6rEnj67Y,33411
15
15
  atlassian/statuspage.py,sha256=M6Ryz4cpLrjqEiv-W6Uch4_OLjdxVILQpUojeAnYYdA,94470
16
16
  atlassian/utils.py,sha256=oKvkGflmgygUcTU-fKd0LBnovgBpu3e5uHsj0sng_vg,10955
@@ -47,8 +47,8 @@ atlassian/bitbucket/server/common/__init__.py,sha256=0j0CWKFaX1kDqfDQkf3__Y2p24t
47
47
  atlassian/bitbucket/server/common/permissions.py,sha256=89KLu4PY5BUJZsjTrJ8JbrQ46EHn1qj_P-ZJ-uGv3dA,7318
48
48
  atlassian/bitbucket/server/projects/__init__.py,sha256=QXHgvrf3lS14OAbtXNdn9TC8ML2fZUkrC5C8BTR3I_0,7696
49
49
  atlassian/bitbucket/server/projects/repos/__init__.py,sha256=GNWhabbnLG7kpgCS85wPzOxtbeCtySchCqFwFZnTdh4,10783
50
- atlassian_python_api-3.41.15.dist-info/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
51
- atlassian_python_api-3.41.15.dist-info/METADATA,sha256=Br4Jq4tdigSGKdia0GRiQEEYiOEf05E57FU-V4r9I3k,8791
52
- atlassian_python_api-3.41.15.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
53
- atlassian_python_api-3.41.15.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
54
- atlassian_python_api-3.41.15.dist-info/RECORD,,
50
+ atlassian_python_api-3.41.16.dist-info/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
51
+ atlassian_python_api-3.41.16.dist-info/METADATA,sha256=uAlw2Iv4MwPUFaFDsPC5fsVr0aHNWtzfrpHpORZdzlU,8791
52
+ atlassian_python_api-3.41.16.dist-info/WHEEL,sha256=5Mi1sN9lKoFv_gxcPtisEVrJZihrm_beibeg5R6xb4I,91
53
+ atlassian_python_api-3.41.16.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
54
+ atlassian_python_api-3.41.16.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (75.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5