atlassian-python-api 3.41.19__py3-none-any.whl → 4.0.0__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 +1 -1
- atlassian/bamboo.py +75 -74
- atlassian/bitbucket/__init__.py +78 -105
- atlassian/bitbucket/base.py +15 -12
- atlassian/bitbucket/cloud/__init__.py +3 -3
- atlassian/bitbucket/cloud/base.py +2 -2
- atlassian/bitbucket/cloud/common/__init__.py +1 -1
- atlassian/bitbucket/cloud/common/builds.py +2 -1
- atlassian/bitbucket/cloud/repositories/__init__.py +26 -28
- atlassian/bitbucket/cloud/repositories/branchRestrictions.py +8 -4
- atlassian/bitbucket/cloud/repositories/commits.py +22 -11
- atlassian/bitbucket/cloud/repositories/defaultReviewers.py +8 -4
- atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py +10 -7
- atlassian/bitbucket/cloud/repositories/hooks.py +1 -1
- atlassian/bitbucket/cloud/repositories/pipelines.py +3 -3
- atlassian/bitbucket/cloud/repositories/pullRequests.py +1 -1
- atlassian/bitbucket/cloud/repositories/refs.py +5 -1
- atlassian/bitbucket/cloud/workspaces/members.py +4 -2
- atlassian/bitbucket/cloud/workspaces/permissions.py +3 -4
- atlassian/bitbucket/cloud/workspaces/projects.py +4 -4
- atlassian/bitbucket/server/__init__.py +1 -1
- atlassian/bitbucket/server/common/__init__.py +1 -1
- atlassian/bitbucket/server/common/permissions.py +2 -2
- atlassian/bitbucket/server/globalPermissions.py +1 -1
- atlassian/bitbucket/server/projects/__init__.py +3 -3
- atlassian/bitbucket/server/projects/repos/__init__.py +5 -5
- atlassian/cloud_admin.py +1 -1
- atlassian/confluence.py +90 -107
- atlassian/crowd.py +10 -15
- atlassian/insight.py +21 -21
- atlassian/jira.py +400 -276
- atlassian/marketplace.py +2 -2
- atlassian/portfolio.py +12 -12
- atlassian/rest_client.py +12 -7
- atlassian/service_desk.py +40 -45
- atlassian/statuspage.py +96 -96
- atlassian/utils.py +6 -6
- atlassian/xray.py +75 -45
- {atlassian_python_api-3.41.19.dist-info → atlassian_python_api-4.0.0.dist-info}/METADATA +20 -8
- atlassian_python_api-4.0.0.dist-info/RECORD +54 -0
- {atlassian_python_api-3.41.19.dist-info → atlassian_python_api-4.0.0.dist-info}/WHEEL +1 -1
- atlassian_python_api-3.41.19.dist-info/RECORD +0 -54
- {atlassian_python_api-3.41.19.dist-info → atlassian_python_api-4.0.0.dist-info/licenses}/LICENSE +0 -0
- {atlassian_python_api-3.41.19.dist-info → atlassian_python_api-4.0.0.dist-info}/top_level.txt +0 -0
atlassian/bitbucket/__init__.py
CHANGED
|
@@ -79,7 +79,7 @@ class Bitbucket(BitbucketBase):
|
|
|
79
79
|
:return: A list of group members
|
|
80
80
|
"""
|
|
81
81
|
|
|
82
|
-
url = "{}/groups/more-members"
|
|
82
|
+
url = f"{self._url_admin()}/groups/more-members"
|
|
83
83
|
params = {}
|
|
84
84
|
if start:
|
|
85
85
|
params["start"] = start
|
|
@@ -150,7 +150,7 @@ class Bitbucket(BitbucketBase):
|
|
|
150
150
|
:param start:
|
|
151
151
|
:return:
|
|
152
152
|
"""
|
|
153
|
-
url = "{
|
|
153
|
+
url = f"{self._url_admin(api_version='1.0')}/users"
|
|
154
154
|
params = {}
|
|
155
155
|
if limit:
|
|
156
156
|
params["limit"] = limit
|
|
@@ -160,6 +160,7 @@ class Bitbucket(BitbucketBase):
|
|
|
160
160
|
params["filter"] = user_filter
|
|
161
161
|
return self._get_paged(url, params=params)
|
|
162
162
|
|
|
163
|
+
@property
|
|
163
164
|
def get_current_license(self):
|
|
164
165
|
"""
|
|
165
166
|
Retrieves details about the current license, as well as the current status of the system with
|
|
@@ -170,11 +171,11 @@ class Bitbucket(BitbucketBase):
|
|
|
170
171
|
are not permitted to access license details.
|
|
171
172
|
:return:
|
|
172
173
|
"""
|
|
173
|
-
url = "{
|
|
174
|
+
url = f"{self._url_admin()}/license"
|
|
174
175
|
return self.get(url)
|
|
175
176
|
|
|
176
177
|
def _url_mail_server(self):
|
|
177
|
-
return "{}/mail-server"
|
|
178
|
+
return f"{self._url_admin()}/mail-server"
|
|
178
179
|
|
|
179
180
|
def get_mail_configuration(self):
|
|
180
181
|
"""
|
|
@@ -186,7 +187,7 @@ class Bitbucket(BitbucketBase):
|
|
|
186
187
|
return self.get(url)
|
|
187
188
|
|
|
188
189
|
def _url_mail_server_sender_address(self):
|
|
189
|
-
return "{}/sender-address"
|
|
190
|
+
return f"{self._url_mail_server()}/sender-address"
|
|
190
191
|
|
|
191
192
|
def get_mail_sender_address(self):
|
|
192
193
|
"""
|
|
@@ -233,13 +234,13 @@ class Bitbucket(BitbucketBase):
|
|
|
233
234
|
:return:
|
|
234
235
|
"""
|
|
235
236
|
url = self.resource_url(
|
|
236
|
-
"commits/{
|
|
237
|
+
f"commits/{commit}",
|
|
237
238
|
api_root="rest/build-status",
|
|
238
239
|
)
|
|
239
240
|
return self.get(url)
|
|
240
241
|
|
|
241
242
|
def _url_announcement_banner(self):
|
|
242
|
-
return "{
|
|
243
|
+
return f"{self._url_admin()}/banner"
|
|
243
244
|
|
|
244
245
|
def get_announcement_banner(self):
|
|
245
246
|
"""
|
|
@@ -284,7 +285,7 @@ class Bitbucket(BitbucketBase):
|
|
|
284
285
|
headers=self.no_check_headers,
|
|
285
286
|
trailing=True,
|
|
286
287
|
).headers["upm-token"]
|
|
287
|
-
url = "rest/plugins/1.0/?token={}"
|
|
288
|
+
url = f"rest/plugins/1.0/?token={upm_token}"
|
|
288
289
|
files = {"plugin": open(plugin_path, "rb")}
|
|
289
290
|
return self.post(url, files=files, headers=self.no_check_headers)
|
|
290
291
|
|
|
@@ -296,9 +297,9 @@ class Bitbucket(BitbucketBase):
|
|
|
296
297
|
:return: If 'repository_slug', returns the list with categories of the repository,
|
|
297
298
|
otherwise, returns the list with the categories of the project 'project_key'
|
|
298
299
|
"""
|
|
299
|
-
url = "project/{}"
|
|
300
|
+
url = f"project/{project_key}"
|
|
300
301
|
if repository_slug:
|
|
301
|
-
url = "{}/repository/{}"
|
|
302
|
+
url = f"{url}/repository/{repository_slug}"
|
|
302
303
|
url = self.resource_url(url, api_root="rest/categories", api_version="latest")
|
|
303
304
|
data = self.get(url)
|
|
304
305
|
return data.get("result").get("categories")
|
|
@@ -342,7 +343,7 @@ class Bitbucket(BitbucketBase):
|
|
|
342
343
|
################################################################################################
|
|
343
344
|
|
|
344
345
|
def _url_project(self, project_key, api_root=None, api_version=None):
|
|
345
|
-
return "{
|
|
346
|
+
return f"{self._url_projects(api_root, api_version)}/{project_key}"
|
|
346
347
|
|
|
347
348
|
def project(self, key):
|
|
348
349
|
"""
|
|
@@ -378,7 +379,7 @@ class Bitbucket(BitbucketBase):
|
|
|
378
379
|
return self.put(url, data=params)
|
|
379
380
|
|
|
380
381
|
def _url_project_avatar(self, project_key):
|
|
381
|
-
return "{}/avatar.png"
|
|
382
|
+
return f"{self._url_project(project_key)}/avatar.png"
|
|
382
383
|
|
|
383
384
|
def project_summary(self, key):
|
|
384
385
|
"""
|
|
@@ -433,7 +434,7 @@ class Bitbucket(BitbucketBase):
|
|
|
433
434
|
:param filter_str: OPTIONAL: users filter string
|
|
434
435
|
:return: The list of SSH access keys
|
|
435
436
|
"""
|
|
436
|
-
url = "{
|
|
437
|
+
url = f"{self._url_project(key, api_root='rest/keys')}/ssh"
|
|
437
438
|
params = {}
|
|
438
439
|
if start:
|
|
439
440
|
params["start"] = start
|
|
@@ -444,7 +445,7 @@ class Bitbucket(BitbucketBase):
|
|
|
444
445
|
return self._get_paged(url, params=params)
|
|
445
446
|
|
|
446
447
|
def _url_project_users(self, project_key):
|
|
447
|
-
return "{}/permissions/users"
|
|
448
|
+
return f"{self._url_project(project_key)}/permissions/users"
|
|
448
449
|
|
|
449
450
|
def project_users(self, key, start=0, limit=None, filter_str=None):
|
|
450
451
|
"""
|
|
@@ -506,7 +507,7 @@ class Bitbucket(BitbucketBase):
|
|
|
506
507
|
return self.delete(url, params=params)
|
|
507
508
|
|
|
508
509
|
def _url_project_groups(self, project_key):
|
|
509
|
-
return "{}/permissions/groups"
|
|
510
|
+
return f"{self._url_project(project_key)}/permissions/groups"
|
|
510
511
|
|
|
511
512
|
def project_groups(self, key, start=0, limit=None, filter_str=None):
|
|
512
513
|
"""
|
|
@@ -562,7 +563,7 @@ class Bitbucket(BitbucketBase):
|
|
|
562
563
|
:param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
|
|
563
564
|
:return:
|
|
564
565
|
"""
|
|
565
|
-
url = "{}/permissions/{}/all"
|
|
566
|
+
url = f"{self._url_project(project_key)}/permissions/{permission}/all"
|
|
566
567
|
return self.get(url)
|
|
567
568
|
|
|
568
569
|
def project_grant_default_permissions(self, project_key, permission):
|
|
@@ -572,7 +573,7 @@ class Bitbucket(BitbucketBase):
|
|
|
572
573
|
:param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
|
|
573
574
|
:return:
|
|
574
575
|
"""
|
|
575
|
-
url = "{}/permissions/{}/all"
|
|
576
|
+
url = f"{self._url_project(project_key)}/permissions/{permission}/all"
|
|
576
577
|
return self.post(url, params={"allow": True})
|
|
577
578
|
|
|
578
579
|
def project_remove_default_permissions(self, project_key, permission):
|
|
@@ -582,11 +583,11 @@ class Bitbucket(BitbucketBase):
|
|
|
582
583
|
:param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
|
|
583
584
|
:return:
|
|
584
585
|
"""
|
|
585
|
-
url = "{}/permissions/{}/all"
|
|
586
|
+
url = f"{self._url_project(project_key)}/permissions/{permission}/all"
|
|
586
587
|
return self.post(url, params={"allow": False})
|
|
587
588
|
|
|
588
589
|
def _url_project_repo_hook_settings(self, project_key):
|
|
589
|
-
return "{}/settings/hooks"
|
|
590
|
+
return f"{self._url_project(project_key)}/settings/hooks"
|
|
590
591
|
|
|
591
592
|
def all_project_repo_hook_settings(self, project_key, start=0, limit=None, filter_type=None):
|
|
592
593
|
"""
|
|
@@ -616,7 +617,7 @@ class Bitbucket(BitbucketBase):
|
|
|
616
617
|
:param hook_key: The repository hook key
|
|
617
618
|
:return:
|
|
618
619
|
"""
|
|
619
|
-
url = "{
|
|
620
|
+
url = f"{self._url_project_repo_hook_settings(project_key)}/{hook_key}"
|
|
620
621
|
return self.get(url)
|
|
621
622
|
|
|
622
623
|
def enable_project_repo_hook_settings(self, project_key, hook_key):
|
|
@@ -626,7 +627,7 @@ class Bitbucket(BitbucketBase):
|
|
|
626
627
|
:param hook_key: The repository hook key
|
|
627
628
|
:return:
|
|
628
629
|
"""
|
|
629
|
-
url = "{}/{}/enabled"
|
|
630
|
+
url = f"{self._url_project_repo_hook_settings(project_key)}/{hook_key}/enabled"
|
|
630
631
|
return self.put(url)
|
|
631
632
|
|
|
632
633
|
def disable_project_repo_hook_settings(self, project_key, hook_key):
|
|
@@ -636,7 +637,7 @@ class Bitbucket(BitbucketBase):
|
|
|
636
637
|
:param hook_key: The repository hook key
|
|
637
638
|
:return:
|
|
638
639
|
"""
|
|
639
|
-
url = "{}/{}/enabled"
|
|
640
|
+
url = f"{self._url_project_repo_hook_settings(project_key)}/{hook_key}/enabled"
|
|
640
641
|
return self.delete(url)
|
|
641
642
|
|
|
642
643
|
def _url_project_conditions(self, project_key):
|
|
@@ -669,7 +670,7 @@ class Bitbucket(BitbucketBase):
|
|
|
669
670
|
)
|
|
670
671
|
)
|
|
671
672
|
if id_condition is not None:
|
|
672
|
-
url += "/{}"
|
|
673
|
+
url += f"/{id_condition}"
|
|
673
674
|
return url
|
|
674
675
|
|
|
675
676
|
def get_project_condition(self, project_key, id_condition):
|
|
@@ -741,7 +742,7 @@ class Bitbucket(BitbucketBase):
|
|
|
741
742
|
if self.cloud:
|
|
742
743
|
raise Exception("Not supported in Bitbucket Cloud")
|
|
743
744
|
|
|
744
|
-
return "{
|
|
745
|
+
return f"{self._url_project(project_key, api_root='rest/audit')}/events"
|
|
745
746
|
|
|
746
747
|
def get_project_audit_log(self, project_key, start=0, limit=None):
|
|
747
748
|
"""
|
|
@@ -760,7 +761,7 @@ class Bitbucket(BitbucketBase):
|
|
|
760
761
|
return self._get_paged(url, params=params)
|
|
761
762
|
|
|
762
763
|
def _url_repos(self, project_key, api_root=None, api_version=None):
|
|
763
|
-
return "{
|
|
764
|
+
return f"{self._url_project(project_key, api_root, api_version)}/repos"
|
|
764
765
|
|
|
765
766
|
def repo_list(self, project_key, start=0, limit=25):
|
|
766
767
|
"""
|
|
@@ -823,7 +824,7 @@ class Bitbucket(BitbucketBase):
|
|
|
823
824
|
################################################################################################
|
|
824
825
|
|
|
825
826
|
def _url_repo(self, project_key, repo, api_root=None, api_version=None):
|
|
826
|
-
return "{
|
|
827
|
+
return f"{self._url_repos(project_key, api_root, api_version)}/{repo}"
|
|
827
828
|
|
|
828
829
|
def reindex_repo(self, project_key, repository_slug):
|
|
829
830
|
"""
|
|
@@ -852,7 +853,7 @@ class Bitbucket(BitbucketBase):
|
|
|
852
853
|
:param repository_slug:
|
|
853
854
|
:return:
|
|
854
855
|
"""
|
|
855
|
-
url = "{
|
|
856
|
+
url = f"{self._url_repo(project_key, repository_slug, api_root='rest/jira-dev')}/reindex"
|
|
856
857
|
return self.post(url)
|
|
857
858
|
|
|
858
859
|
def get_repo(self, project_key, repository_slug):
|
|
@@ -951,7 +952,7 @@ class Bitbucket(BitbucketBase):
|
|
|
951
952
|
:param filter_str: OPTIONAL: users filter string
|
|
952
953
|
:return:
|
|
953
954
|
"""
|
|
954
|
-
url = "{
|
|
955
|
+
url = f"{self._url_repo(project_key, repo_key, api_root='rest/keys')}/ssh"
|
|
955
956
|
params = {}
|
|
956
957
|
if start:
|
|
957
958
|
params["start"] = start
|
|
@@ -962,7 +963,7 @@ class Bitbucket(BitbucketBase):
|
|
|
962
963
|
return self._get_paged(url, params=params)
|
|
963
964
|
|
|
964
965
|
def _url_repo_users(self, project_key, repo):
|
|
965
|
-
return "{
|
|
966
|
+
return f"{self._url_repo(project_key, repo)}/permissions/users"
|
|
966
967
|
|
|
967
968
|
def repo_users(self, project_key, repo_key, start=0, limit=None, filter_str=None):
|
|
968
969
|
"""
|
|
@@ -1014,7 +1015,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1014
1015
|
return self.delete(url, params=params)
|
|
1015
1016
|
|
|
1016
1017
|
def _url_repo_groups(self, project_key, repo):
|
|
1017
|
-
return "{
|
|
1018
|
+
return f"{self._url_repo(project_key, repo)}/permissions/groups"
|
|
1018
1019
|
|
|
1019
1020
|
def repo_groups(self, project_key, repo_key, start=0, limit=None, filter_str=None):
|
|
1020
1021
|
"""
|
|
@@ -1123,7 +1124,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1123
1124
|
if self.cloud:
|
|
1124
1125
|
raise Exception("Not supported in Bitbucket Cloud")
|
|
1125
1126
|
|
|
1126
|
-
return "{
|
|
1127
|
+
return f"{self._url_repo(project_key, repository_slug)}/labels"
|
|
1127
1128
|
|
|
1128
1129
|
def get_repo_labels(self, project_key, repository_slug):
|
|
1129
1130
|
"""
|
|
@@ -1153,7 +1154,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1153
1154
|
if self.cloud:
|
|
1154
1155
|
raise Exception("Not supported in Bitbucket Cloud")
|
|
1155
1156
|
|
|
1156
|
-
return "{
|
|
1157
|
+
return f"{self._url_repo(project_key, repository_slug, api_root='rest/audit')}/events"
|
|
1157
1158
|
|
|
1158
1159
|
def get_repo_audit_log(self, project_key, repository_slug, start=0, limit=None):
|
|
1159
1160
|
"""
|
|
@@ -1173,7 +1174,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1173
1174
|
return self._get_paged(url, params=params)
|
|
1174
1175
|
|
|
1175
1176
|
def _url_repo_branches(self, project_key, repository_slug, api_root=None):
|
|
1176
|
-
return "{
|
|
1177
|
+
return f"{self._url_repo(project_key, repository_slug, api_root=api_root)}/branches"
|
|
1177
1178
|
|
|
1178
1179
|
def get_branches(
|
|
1179
1180
|
self,
|
|
@@ -1219,7 +1220,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1219
1220
|
return self._get_paged(url, params=params)
|
|
1220
1221
|
|
|
1221
1222
|
def _url_repo_default_branche(self, project_key, repository_slug):
|
|
1222
|
-
return "{
|
|
1223
|
+
return f"{self._url_repo_branches(project_key, repository_slug)}/default"
|
|
1223
1224
|
|
|
1224
1225
|
def get_default_branch(self, project_key, repository_slug):
|
|
1225
1226
|
"""
|
|
@@ -1287,9 +1288,9 @@ class Bitbucket(BitbucketBase):
|
|
|
1287
1288
|
|
|
1288
1289
|
def _url_repo_tags(self, project_key, repository_slug, api_root=None):
|
|
1289
1290
|
if self.cloud:
|
|
1290
|
-
return "{
|
|
1291
|
+
return f"{self._url_repo(project_key, repository_slug, api_root=api_root)}/refs/tags"
|
|
1291
1292
|
else:
|
|
1292
|
-
return "{
|
|
1293
|
+
return f"{self._url_repo(project_key, repository_slug, api_root=api_root)}/tags"
|
|
1293
1294
|
|
|
1294
1295
|
def get_tags(
|
|
1295
1296
|
self,
|
|
@@ -1336,7 +1337,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1336
1337
|
"""
|
|
1337
1338
|
url = self._url_repo_tags(project_key, repository_slug)
|
|
1338
1339
|
if tag_name is not None:
|
|
1339
|
-
return self.get("{}/{}"
|
|
1340
|
+
return self.get(f"{url}/{tag_name}")
|
|
1340
1341
|
|
|
1341
1342
|
return self._get_paged(url)
|
|
1342
1343
|
|
|
@@ -1377,14 +1378,11 @@ class Bitbucket(BitbucketBase):
|
|
|
1377
1378
|
:param tag_name:
|
|
1378
1379
|
:return:
|
|
1379
1380
|
"""
|
|
1380
|
-
url = "{}/{}"
|
|
1381
|
-
self._url_repo_tags(project_key, repository_slug, api_root="rest/git"),
|
|
1382
|
-
tag_name,
|
|
1383
|
-
)
|
|
1381
|
+
url = f"{self._url_repo_tags(project_key, repository_slug, api_root='rest/git')}/{tag_name}"
|
|
1384
1382
|
return self.delete(url)
|
|
1385
1383
|
|
|
1386
1384
|
def _url_repo_hook_settings(self, project_key, repository_slug):
|
|
1387
|
-
return "{
|
|
1385
|
+
return f"{self._url_repo(project_key, repository_slug)}/settings/hooks"
|
|
1388
1386
|
|
|
1389
1387
|
def all_repo_hook_settings(
|
|
1390
1388
|
self,
|
|
@@ -1423,10 +1421,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1423
1421
|
:param hook_key: The repository hook key
|
|
1424
1422
|
:return:
|
|
1425
1423
|
"""
|
|
1426
|
-
url = "{}/{}"
|
|
1427
|
-
self._url_repo_hook_settings(project_key, repository_slug),
|
|
1428
|
-
hook_key,
|
|
1429
|
-
)
|
|
1424
|
+
url = f"{self._url_repo_hook_settings(project_key, repository_slug)}/{hook_key}"
|
|
1430
1425
|
return self.get(url)
|
|
1431
1426
|
|
|
1432
1427
|
def enable_repo_hook_settings(self, project_key, repository_slug, hook_key):
|
|
@@ -1437,10 +1432,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1437
1432
|
:param hook_key: The repository hook key
|
|
1438
1433
|
:return:
|
|
1439
1434
|
"""
|
|
1440
|
-
url = "{}/{}/enabled"
|
|
1441
|
-
self._url_repo_hook_settings(project_key, repository_slug),
|
|
1442
|
-
hook_key,
|
|
1443
|
-
)
|
|
1435
|
+
url = f"{self._url_repo_hook_settings(project_key, repository_slug)}/{hook_key}/enabled"
|
|
1444
1436
|
return self.put(url)
|
|
1445
1437
|
|
|
1446
1438
|
def disable_repo_hook_settings(self, project_key, repository_slug, hook_key):
|
|
@@ -1451,14 +1443,11 @@ class Bitbucket(BitbucketBase):
|
|
|
1451
1443
|
:param hook_key: The repository hook key
|
|
1452
1444
|
:return:
|
|
1453
1445
|
"""
|
|
1454
|
-
url = "{}/{}/enabled"
|
|
1455
|
-
self._url_repo_hook_settings(project_key, repository_slug),
|
|
1456
|
-
hook_key,
|
|
1457
|
-
)
|
|
1446
|
+
url = f"{self._url_repo_hook_settings(project_key, repository_slug)}/{hook_key}/enabled"
|
|
1458
1447
|
return self.delete(url)
|
|
1459
1448
|
|
|
1460
1449
|
def _url_webhooks(self, project_key, repository_slug):
|
|
1461
|
-
return "{
|
|
1450
|
+
return f"{self._url_repo(project_key, repository_slug)}/webhooks"
|
|
1462
1451
|
|
|
1463
1452
|
def get_webhooks(
|
|
1464
1453
|
self,
|
|
@@ -1518,7 +1507,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1518
1507
|
return self.post(url, data=body)
|
|
1519
1508
|
|
|
1520
1509
|
def _url_webhook(self, project_key, repository_slug, webhook_id):
|
|
1521
|
-
return "{
|
|
1510
|
+
return f"{self._url_webhooks(project_key, repository_slug)}/{webhook_id}"
|
|
1522
1511
|
|
|
1523
1512
|
def get_webhook(self, project_key, repository_slug, webhook_id):
|
|
1524
1513
|
"""
|
|
@@ -1557,7 +1546,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1557
1546
|
return self.delete(url)
|
|
1558
1547
|
|
|
1559
1548
|
def _url_pull_request_settings(self, project_key, repository_slug):
|
|
1560
|
-
return "{
|
|
1549
|
+
return f"{self._url_repo(project_key, repository_slug)}/settings/pull-requests"
|
|
1561
1550
|
|
|
1562
1551
|
def get_pull_request_settings(self, project_key, repository_slug):
|
|
1563
1552
|
"""
|
|
@@ -1582,9 +1571,9 @@ class Bitbucket(BitbucketBase):
|
|
|
1582
1571
|
|
|
1583
1572
|
def _url_pull_requests(self, project_key, repository_slug):
|
|
1584
1573
|
if self.cloud:
|
|
1585
|
-
return self.resource_url("repositories/{}/{}/pullrequests"
|
|
1574
|
+
return self.resource_url(f"repositories/{project_key}/{repository_slug}/pullrequests")
|
|
1586
1575
|
else:
|
|
1587
|
-
return "{
|
|
1576
|
+
return f"{self._url_repo(project_key, repository_slug)}/pull-requests"
|
|
1588
1577
|
|
|
1589
1578
|
def get_pull_requests(
|
|
1590
1579
|
self,
|
|
@@ -1736,10 +1725,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1736
1725
|
return self.post(url, data=data)
|
|
1737
1726
|
|
|
1738
1727
|
def _url_pull_request(self, project_key, repository_slug, pull_request_id):
|
|
1739
|
-
return "{}/{}"
|
|
1740
|
-
self._url_pull_requests(project_key, repository_slug),
|
|
1741
|
-
pull_request_id,
|
|
1742
|
-
)
|
|
1728
|
+
return f"{self._url_pull_requests(project_key, repository_slug)}/{pull_request_id}"
|
|
1743
1729
|
|
|
1744
1730
|
def get_pull_request(self, project_key, repository_slug, pull_request_id):
|
|
1745
1731
|
"""
|
|
@@ -1813,9 +1799,9 @@ class Bitbucket(BitbucketBase):
|
|
|
1813
1799
|
:return:
|
|
1814
1800
|
"""
|
|
1815
1801
|
if self.cloud:
|
|
1816
|
-
url = "{
|
|
1802
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pull_request_id)}/activity"
|
|
1817
1803
|
else:
|
|
1818
|
-
url = "{
|
|
1804
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pull_request_id)}/activities"
|
|
1819
1805
|
params = {}
|
|
1820
1806
|
if start:
|
|
1821
1807
|
params["start"] = start
|
|
@@ -1840,7 +1826,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1840
1826
|
:param pull_request_id: the ID of the pull request within the repository
|
|
1841
1827
|
:return:
|
|
1842
1828
|
"""
|
|
1843
|
-
url = "{
|
|
1829
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pull_request_id)}/changes"
|
|
1844
1830
|
params = {}
|
|
1845
1831
|
if start:
|
|
1846
1832
|
params["start"] = start
|
|
@@ -1867,7 +1853,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1867
1853
|
:limit
|
|
1868
1854
|
:return:
|
|
1869
1855
|
"""
|
|
1870
|
-
url = "{
|
|
1856
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pull_request_id)}/commits"
|
|
1871
1857
|
params = {}
|
|
1872
1858
|
if start:
|
|
1873
1859
|
params["start"] = start
|
|
@@ -1876,10 +1862,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1876
1862
|
return self._get_paged(url, params)
|
|
1877
1863
|
|
|
1878
1864
|
def _url_pull_request_participants(self, project_key, repository_slug, pull_request_id):
|
|
1879
|
-
return "{}/{}/participants"
|
|
1880
|
-
self._url_pull_requests(project_key, repository_slug),
|
|
1881
|
-
pull_request_id,
|
|
1882
|
-
)
|
|
1865
|
+
return f"{self._url_pull_requests(project_key, repository_slug)}/{pull_request_id}/participants"
|
|
1883
1866
|
|
|
1884
1867
|
def get_pull_requests_participants(
|
|
1885
1868
|
self,
|
|
@@ -1998,10 +1981,7 @@ class Bitbucket(BitbucketBase):
|
|
|
1998
1981
|
:param user_slug:
|
|
1999
1982
|
:return:
|
|
2000
1983
|
"""
|
|
2001
|
-
url = "{}/{}"
|
|
2002
|
-
self._url_pull_request_participants(project_key, repository_slug, pull_request_id),
|
|
2003
|
-
user_slug,
|
|
2004
|
-
)
|
|
1984
|
+
url = f"{self._url_pull_request_participants(project_key, repository_slug, pull_request_id)}/{user_slug}"
|
|
2005
1985
|
approved = True if status == "APPROVED" else False
|
|
2006
1986
|
data = {
|
|
2007
1987
|
"user": {"name": user_slug},
|
|
@@ -2011,7 +1991,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2011
1991
|
return self.put(url, data)
|
|
2012
1992
|
|
|
2013
1993
|
def _url_pull_request_comments(self, project_key, repository_slug, pull_request_id):
|
|
2014
|
-
url = "{
|
|
1994
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pull_request_id)}/comments"
|
|
2015
1995
|
return url
|
|
2016
1996
|
|
|
2017
1997
|
def add_pull_request_comment(
|
|
@@ -2039,10 +2019,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2039
2019
|
return self.post(url, data=body)
|
|
2040
2020
|
|
|
2041
2021
|
def _url_pull_request_comment(self, project_key, repository_slug, pull_request_id, comment_id):
|
|
2042
|
-
url = "{}/{}"
|
|
2043
|
-
self._url_pull_request_comments(project_key, repository_slug, pull_request_id),
|
|
2044
|
-
comment_id,
|
|
2045
|
-
)
|
|
2022
|
+
url = f"{self._url_pull_request_comments(project_key, repository_slug, pull_request_id)}/{comment_id}"
|
|
2046
2023
|
return url
|
|
2047
2024
|
|
|
2048
2025
|
def get_pull_request_comment(self, project_key, repository_slug, pull_request_id, comment_id):
|
|
@@ -2121,7 +2098,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2121
2098
|
return self.delete(url, params=data)
|
|
2122
2099
|
|
|
2123
2100
|
def _url_pull_request_blocker_comments(self, project_key, repository_slug, pull_request_id) -> str:
|
|
2124
|
-
url = "{
|
|
2101
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pull_request_id)}/blocker-comments"
|
|
2125
2102
|
return url
|
|
2126
2103
|
|
|
2127
2104
|
def add_pull_request_blocker_comment(
|
|
@@ -2163,7 +2140,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2163
2140
|
:param pr_version: 12
|
|
2164
2141
|
:return:
|
|
2165
2142
|
"""
|
|
2166
|
-
url = "{
|
|
2143
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pr_id)}/decline"
|
|
2167
2144
|
params = {}
|
|
2168
2145
|
if not self.cloud:
|
|
2169
2146
|
params["version"] = pr_version
|
|
@@ -2179,7 +2156,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2179
2156
|
"""
|
|
2180
2157
|
if self.cloud:
|
|
2181
2158
|
raise Exception("Not supported in Bitbucket Cloud")
|
|
2182
|
-
url = "{
|
|
2159
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pull_request_id)}/tasks"
|
|
2183
2160
|
return self.get(url)
|
|
2184
2161
|
|
|
2185
2162
|
def _url_tasks(self):
|
|
@@ -2199,7 +2176,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2199
2176
|
return self.post(url, data=data)
|
|
2200
2177
|
|
|
2201
2178
|
def _url_task(self, task_id):
|
|
2202
|
-
return "{
|
|
2179
|
+
return f"{self._url_tasks()}/{task_id}"
|
|
2203
2180
|
|
|
2204
2181
|
def get_task(self, task_id):
|
|
2205
2182
|
"""
|
|
@@ -2249,7 +2226,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2249
2226
|
:param pr_id: 2341
|
|
2250
2227
|
:return:
|
|
2251
2228
|
"""
|
|
2252
|
-
url = "{
|
|
2229
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pr_id)}/merge"
|
|
2253
2230
|
return self.get(url)
|
|
2254
2231
|
|
|
2255
2232
|
def merge_pull_request(
|
|
@@ -2276,7 +2253,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2276
2253
|
:param merge_strategy: "squash"
|
|
2277
2254
|
:return:
|
|
2278
2255
|
"""
|
|
2279
|
-
url = "{
|
|
2256
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pr_id)}/merge"
|
|
2280
2257
|
params = {}
|
|
2281
2258
|
data = {
|
|
2282
2259
|
"type": "pullrequest",
|
|
@@ -2300,7 +2277,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2300
2277
|
:param pr_version: 12
|
|
2301
2278
|
:return:
|
|
2302
2279
|
"""
|
|
2303
|
-
url = "{
|
|
2280
|
+
url = f"{self._url_pull_request(project_key, repository_slug, pr_id)}/reopen"
|
|
2304
2281
|
params = {"version": pr_version}
|
|
2305
2282
|
return self.post(url, params=params)
|
|
2306
2283
|
|
|
@@ -2308,7 +2285,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2308
2285
|
return "inbox/pull-requests"
|
|
2309
2286
|
|
|
2310
2287
|
def check_inbox_pull_requests_count(self):
|
|
2311
|
-
url = "{
|
|
2288
|
+
url = f"{self._url_inbox_pull_requests()}/count"
|
|
2312
2289
|
return self.get(url)
|
|
2313
2290
|
|
|
2314
2291
|
def check_inbox_pull_requests(self, start=0, limit=None, role=None):
|
|
@@ -2328,7 +2305,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2328
2305
|
return self._get_paged(url, params=params)
|
|
2329
2306
|
|
|
2330
2307
|
def _url_repo_compare(self, project_key, repository_slug):
|
|
2331
|
-
url = "{
|
|
2308
|
+
url = f"{self._url_repo(project_key, repository_slug)}/compare"
|
|
2332
2309
|
return url
|
|
2333
2310
|
|
|
2334
2311
|
def get_diff(self, project_key, repository_slug, path, hash_oldest, hash_newest):
|
|
@@ -2343,7 +2320,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2343
2320
|
:param hash_newest: the target commit (can be a partial/full commit ID or qualified/unqualified ref name)
|
|
2344
2321
|
:return:
|
|
2345
2322
|
"""
|
|
2346
|
-
url = "{
|
|
2323
|
+
url = f"{self._url_repo_compare(project_key, repository_slug)}/diff/{path}"
|
|
2347
2324
|
params = {}
|
|
2348
2325
|
if hash_oldest:
|
|
2349
2326
|
params["from"] = hash_oldest
|
|
@@ -2492,7 +2469,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2492
2469
|
return self.get(url, params=params)
|
|
2493
2470
|
|
|
2494
2471
|
def _url_commit_pull_requests(self, project_key, repository_slug, commit_id):
|
|
2495
|
-
return "{
|
|
2472
|
+
return f"{self._url_commit(project_key, repository_slug, commit_id)}/pull-requests"
|
|
2496
2473
|
|
|
2497
2474
|
def get_pull_requests_contain_commit(self, project_key, repository_slug, commit):
|
|
2498
2475
|
url = self._url_commit_pull_requests(project_key, repository_slug, commit)
|
|
@@ -2518,7 +2495,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2518
2495
|
fixed system limits. Default by built-in method: None
|
|
2519
2496
|
:return:
|
|
2520
2497
|
"""
|
|
2521
|
-
url = "{
|
|
2498
|
+
url = f"{self._url_repo(project_key, repository_slug)}/compare/commits"
|
|
2522
2499
|
params = {}
|
|
2523
2500
|
if ref_from:
|
|
2524
2501
|
params["from"] = ref_from
|
|
@@ -2641,9 +2618,9 @@ class Bitbucket(BitbucketBase):
|
|
|
2641
2618
|
:param limit: OPTIONAL
|
|
2642
2619
|
:return:
|
|
2643
2620
|
"""
|
|
2644
|
-
url = "{
|
|
2621
|
+
url = f"{self._url_repo(project_key, repository_slug)}/files"
|
|
2645
2622
|
if sub_folder:
|
|
2646
|
-
url = "{}/{
|
|
2623
|
+
url = f"{url}/{sub_folder.lstrip('/')}"
|
|
2647
2624
|
params = {}
|
|
2648
2625
|
if query:
|
|
2649
2626
|
params["at"] = query
|
|
@@ -2665,7 +2642,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2665
2642
|
otherwise, if not specified, or any value other than "true" the content is streamed without markup.
|
|
2666
2643
|
:return:
|
|
2667
2644
|
"""
|
|
2668
|
-
url = "{
|
|
2645
|
+
url = f"{self._url_repo(project_key, repository_slug)}/raw/{filename}"
|
|
2669
2646
|
params = {}
|
|
2670
2647
|
if at is not None:
|
|
2671
2648
|
params["at"] = at
|
|
@@ -2689,7 +2666,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2689
2666
|
api_version="2.0",
|
|
2690
2667
|
)
|
|
2691
2668
|
|
|
2692
|
-
return "{}/restrictions/{
|
|
2669
|
+
return f"{base}/restrictions/{'' if permission_id is None else str(permission_id)}"
|
|
2693
2670
|
|
|
2694
2671
|
def get_branches_permissions(
|
|
2695
2672
|
self,
|
|
@@ -2895,7 +2872,7 @@ class Bitbucket(BitbucketBase):
|
|
|
2895
2872
|
return self.delete(self._url_branching_model(project_key, repository_slug))
|
|
2896
2873
|
|
|
2897
2874
|
def _url_file(self, project_key, repository_slug, filename):
|
|
2898
|
-
return "{
|
|
2875
|
+
return f"{self._url_repo(project_key, repository_slug)}/browse/{filename}"
|
|
2899
2876
|
|
|
2900
2877
|
def upload_file(self, project_key, repository_slug, content, message, branch, filename):
|
|
2901
2878
|
"""
|
|
@@ -2948,22 +2925,18 @@ class Bitbucket(BitbucketBase):
|
|
|
2948
2925
|
:team: str
|
|
2949
2926
|
:search_query: str
|
|
2950
2927
|
"""
|
|
2951
|
-
url = self.resource_url("teams/{team}/search/code"
|
|
2928
|
+
url = self.resource_url(f"teams/{team}/search/code")
|
|
2952
2929
|
return self.get(
|
|
2953
2930
|
url,
|
|
2954
2931
|
params={"search_query": search_query, "page": page, "pagelen": limit},
|
|
2955
2932
|
)
|
|
2956
2933
|
|
|
2957
2934
|
def get_lfs_repo_status(self, project_key, repo):
|
|
2958
|
-
url = "rest/git-lfs/admin/projects/{
|
|
2959
|
-
projectKey=project_key, repositorySlug=repo
|
|
2960
|
-
)
|
|
2935
|
+
url = f"rest/git-lfs/admin/projects/{project_key}/repos/{repo}/enabled"
|
|
2961
2936
|
return self.get(url)
|
|
2962
2937
|
|
|
2963
2938
|
def set_lfs_repo_status(self, project_key, repo, enable=True):
|
|
2964
|
-
url = "rest/git-lfs/admin/projects/{
|
|
2965
|
-
projectKey=project_key, repositorySlug=repo
|
|
2966
|
-
)
|
|
2939
|
+
url = f"rest/git-lfs/admin/projects/{project_key}/repos/{repo}/enabled"
|
|
2967
2940
|
if enable:
|
|
2968
2941
|
return self.put(url)
|
|
2969
2942
|
else:
|
|
@@ -3143,7 +3116,7 @@ class Bitbucket(BitbucketBase):
|
|
|
3143
3116
|
if the supplied prefix does not end with a trailing /, one will be added automatically
|
|
3144
3117
|
:param chunk_size: int: Optional, download chunk size. Defeault is 128
|
|
3145
3118
|
"""
|
|
3146
|
-
url = "{
|
|
3119
|
+
url = f"{self._url_repo(project_key, repository_slug)}/archive"
|
|
3147
3120
|
params = {}
|
|
3148
3121
|
if at is not None:
|
|
3149
3122
|
params["at"] = at
|