@@ -1539,11 +1539,9 @@ class ProjectSnippet(GitlabObject):
15391539 [('project_id' , 'project_id' ), ('snippet_id' , 'id' )])]
15401540
15411541 def Content (self , ** kwargs ):
1542- url = ("/projects/%(project_id)s/snippets/%(snippet_id)s/raw" %
1543- {'project_id' : self .project_id , 'snippet_id' : self .id })
1544- r = self .gitlab ._raw_get (url , ** kwargs )
1545- raise_error_from_response (r , GitlabGetError )
1546- return r .content
1542+ warnings .warn ("`Content` is deprecated, use `content` instead" ,
1543+ DeprecationWarning )
1544+ return self .content ()
15471545
15481546 def Note (self , id = None , ** kwargs ):
15491547 warnings .warn ("`Note` is deprecated, use `notes` instead" ,
@@ -1554,6 +1552,30 @@ def Note(self, id=None, **kwargs):
15541552 snippet_id = self .id ,
15551553 ** kwargs )
15561554
1555+ def content (self , streamed = False , action = None , chunk_size = 1024 , ** kwargs ):
1556+ """Return the raw content of a snippet.
1557+
1558+ Args:
1559+ streamed (bool): If True the data will be processed by chunks of
1560+ `chunk_size` and each chunk is passed to `action` for
1561+ treatment.
1562+ action (callable): Callable responsible of dealing with chunk of
1563+ data.
1564+ chunk_size (int): Size of each chunk.
1565+
1566+ Returns:
1567+ str: The snippet content
1568+
1569+ Raises:
1570+ GitlabConnectionError: If the server cannot be reached.
1571+ GitlabGetError: If the server fails to perform the request.
1572+ """
1573+ url = ("/projects/%(project_id)s/snippets/%(snippet_id)s/raw" %
1574+ {'project_id' : self .project_id , 'snippet_id' : self .id })
1575+ r = self .gitlab ._raw_get (url , ** kwargs )
1576+ raise_error_from_response (r , GitlabGetError )
1577+ return utils .response_content (r , streamed , action , chunk_size )
1578+
15571579
15581580class ProjectSnippetManager (BaseManager ):
15591581 obj_cls = ProjectSnippet
0 commit comments