atlassian-python-api 3.41.19__py3-none-any.whl → 3.41.21__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.19
1
+ 3.41.21
@@ -1 +1 @@
1
- """ Bitbucket Cloud common package """
1
+ """Bitbucket Cloud common package"""
@@ -27,7 +27,7 @@ class Repositories(RepositoriesBase):
27
27
  def __init__(self, url, *args, **kwargs):
28
28
  super(Repositories, self).__init__(url, *args, **kwargs)
29
29
 
30
- def each(self, after=None, role=None, q=None, sort=None):
30
+ def each(self, after=None, role=None, q=None, sort=None, pagelen=None):
31
31
  """
32
32
  Get all repositories matching the criteria.
33
33
 
@@ -47,6 +47,8 @@ class Repositories(RepositoriesBase):
47
47
  See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering for details.
48
48
  :param sort: string: Name of a response property to sort results.
49
49
  See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering for details.
50
+ :param pagelen: int: Name of a response property to change page size.
51
+ See https://developer.atlassian.com/cloud/bitbucket/rest/intro/#pagination for details.
50
52
 
51
53
  :return: A generator for the repository objects
52
54
 
@@ -64,6 +66,8 @@ class Repositories(RepositoriesBase):
64
66
  params["q"] = q
65
67
  if sort is not None:
66
68
  params["sort"] = sort
69
+ if pagelen is not None:
70
+ params["pagelen"] = pagelen
67
71
  for repository in self._get_paged(None, params):
68
72
  yield self._get_object(repository)
69
73
 
@@ -32,7 +32,7 @@ class Refs(BitbucketCloudBase):
32
32
 
33
33
  return self._get_object(self.post(None, data))
34
34
 
35
- def each(self, q=None, sort=None):
35
+ def each(self, q=None, sort=None, pagelen=None):
36
36
  """
37
37
  Returns the list of refs in this repository.
38
38
 
@@ -40,6 +40,8 @@ class Refs(BitbucketCloudBase):
40
40
  See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering for details.
41
41
  :param sort: string: Name of a response property to sort results.
42
42
  See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering for details.
43
+ :param pagelen: int: Name of a response property to change page size.
44
+ See https://developer.atlassian.com/cloud/bitbucket/rest/intro/#pagination for details.
43
45
 
44
46
  :return: A generator for the Ref objects
45
47
  """
@@ -48,6 +50,8 @@ class Refs(BitbucketCloudBase):
48
50
  params["sort"] = sort
49
51
  if q is not None:
50
52
  params["q"] = q
53
+ if pagelen is not None:
54
+ params["pagelen"] = pagelen
51
55
  for ref in self._get_paged(None, trailing=True, params=params):
52
56
  yield self._get_object(super(Refs, self).get(ref.get("name")))
53
57
 
@@ -1 +1 @@
1
- """ Bitbucket Server common package """
1
+ """Bitbucket Server common package"""
atlassian/confluence.py CHANGED
@@ -1470,8 +1470,7 @@ class Confluence(AtlassianRestAPI):
1470
1470
  file_name = attachment["title"] or attachment["id"] # Use attachment ID if title is unavailable
1471
1471
  download_link = self.url + attachment["_links"]["download"]
1472
1472
  # Fetch the file content
1473
- response = self._session.get(str(download_link))
1474
- response.raise_for_status() # Raise error if request fails
1473
+ response = self.get(str(download_link))
1475
1474
 
1476
1475
  if to_memory:
1477
1476
  # Store in BytesIO object
@@ -1493,7 +1492,11 @@ class Confluence(AtlassianRestAPI):
1493
1492
  except PermissionError:
1494
1493
  raise PermissionError("Permission denied when trying to save files to '{path}'.".format(path=path))
1495
1494
  except requests.HTTPError as http_err:
1496
- raise Exception("HTTP error occurred while downloading attachments: {http_err}".format(http_err=http_err))
1495
+ raise requests.HTTPError(
1496
+ "HTTP error occurred while downloading attachments: {http_err}".format(http_err=http_err),
1497
+ response=http_err.response,
1498
+ request=http_err.request,
1499
+ )
1497
1500
  except Exception as err:
1498
1501
  raise Exception("An unexpected error occurred: {error}".format(error=err))
1499
1502
 
atlassian/jira.py CHANGED
@@ -242,6 +242,16 @@ class Jira(AtlassianRestAPI):
242
242
  url = "{base_url}/{attachment_id}".format(base_url=base_url, attachment_id=attachment_id)
243
243
  return self.get(url)
244
244
 
245
+ def download_issue_attachments(self, issue, path=None):
246
+ """
247
+ Downloads all attachments from a Jira issue.
248
+ :param issue: The issue-key of the Jira issue
249
+ :param path: Path to directory where attachments will be saved. If None, current working directory will be used.
250
+ :return: A message indicating the result of the download operation.
251
+ """
252
+ return self.download_attachments_from_issue(issue=issue, path=path, cloud=self.cloud)
253
+
254
+ @deprecated(version="3.41.20", reason="Use download_issue_attachments instead")
245
255
  def download_attachments_from_issue(self, issue, path=None, cloud=True):
246
256
  """
247
257
  Downloads all attachments from a Jira issue.
@@ -3764,6 +3774,53 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
3764
3774
  url = "{base_url}/{schemeID}/permission".format(base_url=base_url, schemeID=permission_id)
3765
3775
  return self.post(url, data=new_permission)
3766
3776
 
3777
+ def update_permissionscheme(self, permission_id, name, description=None, permissions=None, scope=None, expand=None):
3778
+ """
3779
+ Updates a permission scheme. Below are some important things to note when using this resource:
3780
+ - If a permissions list is present in the request, then it is set in the permission scheme, overwriting all existing grants.
3781
+ - If you want to update only the name and description, then do not send a permissions list in the request.
3782
+ - Sending an empty list will remove all permission grants from the permission scheme.
3783
+
3784
+ Cloud API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permission-schemes/#api-rest-api-3-permissionscheme-schemeid-put
3785
+
3786
+ :param permission_id: int, REQUIRED: The ID of the permission scheme to update.
3787
+ :param name: str, REQUIRED: The name of the permission scheme. Must be unique.
3788
+ :param description: str, OPTIONAL: A description for the permission scheme. Defaults to None.
3789
+ :param permissions: list[dict], OPTIONAL: A collection of permission grants. Defaults to None.
3790
+ Example:
3791
+ [
3792
+ {
3793
+ "holder": {
3794
+ "parameter": "jira-core-users",
3795
+ "type": "group",
3796
+ "value": "ca85fac0-d974-40ca-a615-7af99c48d24f"
3797
+ },
3798
+ "permission": "ADMINISTER_PROJECTS"
3799
+ }
3800
+ ]
3801
+ :param scope: OPTIONAL: The scope of the permission scheme.
3802
+ :param expand: str, OPTIONAL: Use expand to include additional information in the response.
3803
+ This parameter accepts a comma-separated list.
3804
+ Note that permissions are always included when you specify any value.
3805
+
3806
+ :return:
3807
+ """
3808
+ base_url = self.resource_url("permissionscheme")
3809
+ url = "{base_url}/{scheme_id}".format(base_url=base_url, scheme_id=permission_id)
3810
+ data = {"name": name}
3811
+ if description is not None:
3812
+ data["description"] = description
3813
+ if permissions is not None:
3814
+ data["permissions"] = permissions
3815
+ if scope is not None:
3816
+ data["scope"] = scope
3817
+
3818
+ params = {}
3819
+ if expand:
3820
+ params["expand"] = expand
3821
+
3822
+ return self.put(url, data=data, params=params)
3823
+
3767
3824
  """
3768
3825
  REST resource that allows to view security schemes defined in the product.
3769
3826
  Resource for managing priority schemes.
atlassian/rest_client.py CHANGED
@@ -161,6 +161,7 @@ class AtlassianRestAPI(object):
161
161
  backoff_factor=self.backoff_factor,
162
162
  backoff_jitter=self.backoff_jitter,
163
163
  backoff_max=self.max_backoff_seconds,
164
+ respect_retry_after_header=self.retry_with_header,
164
165
  )
165
166
  self._session.mount(self.url, HTTPAdapter(max_retries=retries))
166
167
  if username and password:
atlassian/xray.py CHANGED
@@ -1,6 +1,7 @@
1
1
  # coding=utf-8
2
2
  import logging
3
3
  import re
4
+ from requests import HTTPError
4
5
  from .rest_client import AtlassianRestAPI
5
6
 
6
7
  log = logging.getLogger(__name__)
@@ -13,6 +14,25 @@ class Xray(AtlassianRestAPI):
13
14
  kwargs["api_root"] = "rest/raven"
14
15
  super(Xray, self).__init__(*args, **kwargs)
15
16
 
17
+ def raise_for_status(self, response):
18
+ """
19
+ Checks the response for an error status and raises an exception with the error message provided by the server
20
+ :param response:
21
+ :return:
22
+ """
23
+ if response.status_code == 401 and response.headers.get("Content-Type") != "application/json;charset=UTF-8":
24
+ raise HTTPError("Unauthorized (401)", response=response)
25
+
26
+ if 400 <= response.status_code < 600:
27
+ try:
28
+ j = response.json()
29
+ error_msg = j["message"]
30
+ except Exception as e:
31
+ log.error(e)
32
+ response.raise_for_status()
33
+ else:
34
+ raise HTTPError(error_msg, response=response)
35
+
16
36
  def resource_url(self, resource, api_root=None, api_version=None):
17
37
  """
18
38
  Overloading the method from AtlassianRestAPI to be compatible with the "middle man" version used by Xray.
@@ -463,6 +483,16 @@ class Xray(AtlassianRestAPI):
463
483
  url = self.resource_url("testrun/{0}".format(test_run_id))
464
484
  return self.put(url, update)
465
485
 
486
+ def get_test_run_iteration(self, test_run_id, iteration_id):
487
+ """
488
+ Retrieve the specified iteration for the given test run.
489
+ :param test_run_id: ID of the test run (e.g. 100).
490
+ :param iteration_id: ID of the iteration.
491
+ :return: Returns the specified iteration for the given test run.
492
+ """
493
+ url = self.resource_url("testrun/{0}/iteration/{1}".format(test_run_id, iteration_id))
494
+ return self.get(url)
495
+
466
496
  def get_test_run_status(self, test_run_id):
467
497
  """
468
498
  Retrieve the status for the given test run.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: atlassian-python-api
3
- Version: 3.41.19
3
+ Version: 3.41.21
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,29 +1,29 @@
1
- atlassian/VERSION,sha256=Rypy1NjRxwpuIXl3iANLEvusT4m5fPhqxWzJ8lV8Ano,8
1
+ atlassian/VERSION,sha256=O5dBKwitImKiKQKLHtL4PSYF2dcaBbDHylGcl7paUq4,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=VYNGzn4qR6Ti-ZIzUir-YdRMW5P6hDjxonYFLt7TgKA,134572
5
+ atlassian/confluence.py,sha256=8HiGY6W1uap6_l63vTMhoMHlJjeWbtXDt4qBFbm49Bk,134613
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=6R9jxOqdFZKpWp5KPWVBKftcxdxbWAXbYdycHux3DdE,23717
9
- atlassian/jira.py,sha256=khrWh74Ze4h3S3EkaL5IWa3LYiQKUgnnE1j1vXlrIvs,210353
9
+ atlassian/jira.py,sha256=vmHixouZH2jn-moUchcpluCPDd8hSXRDSB_6WbCmXsQ,213323
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=Lhqaa1W2L1e0eVcIc_2eYwvbjDAW8xYrqzgzFqJa8GU,23924
13
+ atlassian/rest_client.py,sha256=DBdRNPZ5coJy_LzcgBBtisX5vD2d1pU_P1qjuWak1nc,23991
14
14
  atlassian/service_desk.py,sha256=LPvPHl2yuzdaBV7lgRUXNyOESquZUjp7sV3vXwekQfU,33567
15
15
  atlassian/statuspage.py,sha256=M6Ryz4cpLrjqEiv-W6Uch4_OLjdxVILQpUojeAnYYdA,94470
16
16
  atlassian/utils.py,sha256=oKvkGflmgygUcTU-fKd0LBnovgBpu3e5uHsj0sng_vg,10955
17
- atlassian/xray.py,sha256=3OvLMNfTxfCXgKXxpjhq3a01RemOEtvJH9OqbCJrHEs,26219
17
+ atlassian/xray.py,sha256=Be7FE0b-AlgCgYXMs8xamHAliHUgVqXIoWZawOh4XI4,27453
18
18
  atlassian/bitbucket/__init__.py,sha256=VmpVH3EWKm3eQMTFBLVwJDRfDlbQ_EP3EMgRryAPzQA,136984
19
19
  atlassian/bitbucket/base.py,sha256=aZpA8J-iMWVahXLCUt-X2MmZ1nG20wCGD0ykKlZrEJ0,6447
20
20
  atlassian/bitbucket/cloud/__init__.py,sha256=MX58kb4PKRK5M_iLyh0pya0FG8c9cYJkCAEVsugiGok,821
21
21
  atlassian/bitbucket/cloud/base.py,sha256=P1GkxC1zE3WSYMtkNhCGBznHT-bg_WKBa5rt_Jqk5h0,4287
22
- atlassian/bitbucket/cloud/common/__init__.py,sha256=5r9gwfcmU-AwZXG4kjU_Jpj_R72MLXJXOn0otMYAg4c,39
22
+ atlassian/bitbucket/cloud/common/__init__.py,sha256=xhpE0cKTpx6a1jjazmjIexNFuq0a5gpzefmM_NnH7fw,37
23
23
  atlassian/bitbucket/cloud/common/builds.py,sha256=Gka9aQIKxzzCU3JGHg97zNEz01_eFyOpJA9su-D2C_I,2366
24
24
  atlassian/bitbucket/cloud/common/comments.py,sha256=ktnN9G0Vr49rIAeqTElnEXvpePp6roUw_Om06JnEb-4,1329
25
25
  atlassian/bitbucket/cloud/common/users.py,sha256=BbjkMeNFp7JwuewbKL_5qO1geuZ5iu3u5AThPu1pYJo,2390
26
- atlassian/bitbucket/cloud/repositories/__init__.py,sha256=go2mUdLJzihGsA73ChaJGafDdrds7LHD_ejBSZ8R_Uk,16969
26
+ atlassian/bitbucket/cloud/repositories/__init__.py,sha256=IHfzRNSCmy1thN8t5trknvhLPlSNenokfxYczMfwP68,17250
27
27
  atlassian/bitbucket/cloud/repositories/branchRestrictions.py,sha256=E1wr1pheH9UnVLMao8-9rwmNZPJeLRoM1AmFQnfe4jQ,6503
28
28
  atlassian/bitbucket/cloud/repositories/commits.py,sha256=Tr4YKVrNdQXQ4nIKtMfCOTLJwnF3MVBGVJcjCKvbNlU,7668
29
29
  atlassian/bitbucket/cloud/repositories/defaultReviewers.py,sha256=bSa1iPILiKf9IcWcCYCQtYxQHoqeiuYGBHD7JVmXa-4,3560
@@ -34,7 +34,7 @@ atlassian/bitbucket/cloud/repositories/hooks.py,sha256=erNk58XuROeG4ruAqNLFTxpyR
34
34
  atlassian/bitbucket/cloud/repositories/issues.py,sha256=rJzPfhETsI7qqi9xyo_MwaTPnwxmQe2pyBYTLyMf9Eg,5065
35
35
  atlassian/bitbucket/cloud/repositories/pipelines.py,sha256=i4Vb0r3exi7gSkG0W1VGvB8x-DzZQn4RVrOHVo2e2rQ,9157
36
36
  atlassian/bitbucket/cloud/repositories/pullRequests.py,sha256=11xN8-_wUT-eV-A39fCRW-jm6jm9Qn1ClpLZiaZtEJk,16253
37
- atlassian/bitbucket/cloud/repositories/refs.py,sha256=9PKHp47uQIUeYsxzfemMRFMiGhHZfAJJJC_-ZzhQ_J8,3732
37
+ atlassian/bitbucket/cloud/repositories/refs.py,sha256=hrZKaXa7_7PYO7bNGkdq6onF8YB46eBhLd56o1miEfY,4013
38
38
  atlassian/bitbucket/cloud/repositories/repositoryVariables.py,sha256=jiN-X-x2pX2g924emGKYCFd0dp-UAn6XoFVbBj4lfk0,5034
39
39
  atlassian/bitbucket/cloud/workspaces/__init__.py,sha256=Pos5ktbVEqfcP6tTV5P-DzZL43ElDSjYT9y1CLgJnrM,5081
40
40
  atlassian/bitbucket/cloud/workspaces/members.py,sha256=qTQAC82b1E0B41dVwoCoJQgNRM9ewPM49usEHAr6NAw,1759
@@ -43,12 +43,12 @@ atlassian/bitbucket/cloud/workspaces/projects.py,sha256=oYm3Wj_RZYmeeim-j8e0-qQI
43
43
  atlassian/bitbucket/server/__init__.py,sha256=v3sCf4A6-hTYaf_6ZcCDJJk0qqDGZYG5uoNArxNGSyQ,1613
44
44
  atlassian/bitbucket/server/base.py,sha256=43GYeayyCzqwFlJC3P1zYRJ4T948I1JCL5b62f1sIDo,1839
45
45
  atlassian/bitbucket/server/globalPermissions.py,sha256=_0LMi4KqQZAfm34tHaMfMyDYShB4QMZsol1SWY3OrCM,5975
46
- atlassian/bitbucket/server/common/__init__.py,sha256=0j0CWKFaX1kDqfDQkf3__Y2p24t1tS4wfOV8ZjZ9j5M,40
46
+ atlassian/bitbucket/server/common/__init__.py,sha256=woZpR3WXAA3A99hZ1UZI_gLPHaATxEyCWW7GRTCI4e4,38
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=jvoi3Xp8fdL_-00U6XvxsJ6ThxnXsn0QewKYiZu_s_A,10810
50
- atlassian_python_api-3.41.19.dist-info/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
51
- atlassian_python_api-3.41.19.dist-info/METADATA,sha256=1k9mwpETNRKwpUMeJUd37iGR1qtnQOEtUSamNXh9JPA,9074
52
- atlassian_python_api-3.41.19.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
53
- atlassian_python_api-3.41.19.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
54
- atlassian_python_api-3.41.19.dist-info/RECORD,,
50
+ atlassian_python_api-3.41.21.dist-info/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
51
+ atlassian_python_api-3.41.21.dist-info/METADATA,sha256=N-rodrMaadIyh_bBO_fYyPWOhsPjvxEVsc5QV3YMhPM,9074
52
+ atlassian_python_api-3.41.21.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
53
+ atlassian_python_api-3.41.21.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
54
+ atlassian_python_api-3.41.21.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5