Skip to content

Commit

Permalink
Add support for Project raw_blob
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed May 8, 2016
1 parent 23e8146 commit 7a8f81b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gitlab/objects.py
Expand Up @@ -1474,6 +1474,24 @@ def blob(self, sha, filepath, **kwargs):
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.
Expand Down

0 comments on commit 7a8f81b

Please sign in to comment.