@@ -1539,11 +1539,9 @@ class ProjectSnippet(GitlabObject):
1539
1539
[('project_id' , 'project_id' ), ('snippet_id' , 'id' )])]
1540
1540
1541
1541
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 ()
1547
1545
1548
1546
def Note (self , id = None , ** kwargs ):
1549
1547
warnings .warn ("`Note` is deprecated, use `notes` instead" ,
@@ -1554,6 +1552,30 @@ def Note(self, id=None, **kwargs):
1554
1552
snippet_id = self .id ,
1555
1553
** kwargs )
1556
1554
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
+
1557
1579
1558
1580
class ProjectSnippetManager (BaseManager ):
1559
1581
obj_cls = ProjectSnippet
0 commit comments