diff options
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index 2ceb37f..a7f35bd 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -1474,6 +1474,24 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabGetError) return r.content + def raw_blob(self, sha, **kwargs): + """Return the raw file contents for a blob by blob SHA. + + Args: + sha(str): ID of the blob + + Returns: + str: The blob content + + Raises: + GitlabConnectionError: If the server cannot be reached. + GitlabGetError: If the server fails to perform the request. + """ + url = "/projects/%s/repository/raw_blobs/%s" % (self.id, sha) + r = self.gitlab._raw_get(url, **kwargs) + raise_error_from_response(r, GitlabGetError) + return r.content + def archive(self, sha=None, **kwargs): """Return a tarball of the repository. |