Skip to content

Commit 7a8f81b

Browse files
author
Gauvain Pocentek
committed
Add support for Project raw_blob
1 parent 23e8146 commit 7a8f81b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

gitlab/objects.py

+18
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,24 @@ def blob(self, sha, filepath, **kwargs):
14741474
raise_error_from_response(r, GitlabGetError)
14751475
return r.content
14761476

1477+
def raw_blob(self, sha, **kwargs):
1478+
"""Return the raw file contents for a blob by blob SHA.
1479+
1480+
Args:
1481+
sha(str): ID of the blob
1482+
1483+
Returns:
1484+
str: The blob content
1485+
1486+
Raises:
1487+
GitlabConnectionError: If the server cannot be reached.
1488+
GitlabGetError: If the server fails to perform the request.
1489+
"""
1490+
url = "/projects/%s/repository/raw_blobs/%s" % (self.id, sha)
1491+
r = self.gitlab._raw_get(url, **kwargs)
1492+
raise_error_from_response(r, GitlabGetError)
1493+
return r.content
1494+
14771495
def archive(self, sha=None, **kwargs):
14781496
"""Return a tarball of the repository.
14791497

0 commit comments

Comments
 (0)