Skip to content

Commit 6bcd2c0

Browse files
authored
Merge branch 'atlassian-api:master' into master
2 parents b70f618 + d4ef596 commit 6bcd2c0

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
make docker-qa PYTHON_VERSION=${{matrix.python-version}}
3232
- name: Creating coverage report
3333
if: ${{ ( matrix.python-version == '3.8' ) }}
34-
uses: codecov/codecov-action@v4
34+
uses: codecov/codecov-action@v3
3535
with:
3636
files: ./coverage.xml
3737
fail_ci_if_error: true

atlassian/bitbucket/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ def markup_preview(self, data):
3939
def _url_admin(self, api_version=None):
4040
return self.resource_url("admin", api_version=api_version)
4141

42+
def get_groups(self, group_filter=None, limit=25, start=0):
43+
"""
44+
Get list of bitbucket groups.
45+
Use 'group_filter' for get specific group or get all group if necessary.
46+
47+
:param group_filter: str - groupname
48+
:param limit: int - paginated limit to retrieve
49+
:param start: int - paginated point to start retrieving
50+
:return: The collection as JSON with all relevant information about the group
51+
"""
52+
url = self.resource_url("groups", api_version="1.0")
53+
params = {}
54+
if group_filter:
55+
params["filter"] = group_filter
56+
if limit:
57+
params["limit"] = limit
58+
if start:
59+
params["start"] = start
60+
return self._get_paged(url, params=params)
61+
4262
def group_members(self, group, start=0, limit=None):
4363
"""
4464
Get group of members

docs/bitbucket.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ Groups and admins
160160

161161
.. code-block:: python
162162
163+
# Get groups. Use 'group_filter' parameter to get specific groups.
164+
bitbucket.groups(group_filter="group", limit=99999)
165+
163166
# Get group of members
164167
bitbucket.group_members(group, limit=99999)
165168
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# coding=utf-8
2+
from atlassian import Bitbucket
3+
4+
bitbucket = Bitbucket(url="http://localhost:7990", username="admin", password="admin")
5+
6+
data = bitbucket.get_groups(group_filter="group")
7+
print(data)

0 commit comments

Comments
 (0)