Skip to content

Commit 2d8e1a4

Browse files
committed
Bitbucket Cloud: allow to access repositories directly
This allows to access a Repository object without having access to the workspace endpoint. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
1 parent 6d8545a commit 2d8e1a4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

atlassian/bitbucket/cloud/repositories/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ def each(self, after=None, role=None, q=None, sort=None):
6262
for repository in self._get_paged(None, params):
6363
yield self._get_object(repository)
6464

65+
def get(self, repository):
66+
"""
67+
Returns the requested repository.
68+
69+
Since this method accesses the repository endpoint
70+
directly it is usable if you do not have permission
71+
to access the workspace endpoint.
72+
73+
:param repository: string: The requested repository. Needs to be
74+
the full name {workspace}/{slug}.
75+
76+
:return: The requested Repository object
77+
78+
API docs: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-get
79+
"""
80+
return self._get_object(super(Repositories, self).get(repository))
81+
6582

6683
class WorkspaceRepositories(RepositoriesBase):
6784
ALLOW_FORKS = "allow_forks"

0 commit comments

Comments
 (0)