diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-05-08 11:55:04 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-05-08 11:55:04 +0200 |
commit | 7a8f81b32e47dab6da495f5cefffe48566934744 (patch) | |
tree | 8c0dca1e74d55016e0244310c30d7ae1149129a1 /gitlab/objects.py | |
parent | 23e8146a391e4269e9b3d57a553148963d412179 (diff) | |
download | gitlab-7a8f81b32e47dab6da495f5cefffe48566934744.tar.gz |
Add support for Project raw_blob
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. |