diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2020-04-05 16:12:11 +0200 |
---|---|---|
committer | Nejc Habjan <hab.nejc@gmail.com> | 2020-04-05 16:12:11 +0200 |
commit | 6ce5d1f14060a403f05993d77bf37720c25534ba (patch) | |
tree | dbede14206cb7466a3abfee99cea8b2d13f2b4d0 /gitlab/v4 | |
parent | 50fcd1237613645031410386e87b96b81ef5fb78 (diff) | |
download | gitlab-6ce5d1f14060a403f05993d77bf37720c25534ba.tar.gz |
chore(mixins): factor out export download into ExportMixin
Diffstat (limited to 'gitlab/v4')
-rw-r--r-- | gitlab/v4/objects.py | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 8852a1e..281d3c7 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -4097,36 +4097,9 @@ class ProjectWikiManager(CRUDMixin, RESTManager): _list_filters = ("with_content",) -class ProjectExport(RefreshMixin, RESTObject): +class ProjectExport(ExportMixin, RefreshMixin, RESTObject): _id_attr = None - @cli.register_custom_action("ProjectExport") - @exc.on_http_error(exc.GitlabGetError) - def download(self, streamed=False, action=None, chunk_size=1024, **kwargs): - """Download the archive of a project export. - - Args: - streamed (bool): If True the data will be processed by chunks of - `chunk_size` and each chunk is passed to `action` for - reatment - action (callable): Callable responsible of dealing with chunk of - data - chunk_size (int): Size of each chunk - **kwargs: Extra options to send to the server (e.g. sudo) - - Raises: - GitlabAuthenticationError: If authentication is not correct - GitlabGetError: If the server failed to perform the request - - Returns: - str: The blob content if streamed is False, None otherwise - """ - path = "/projects/%s/export/download" % self.project_id - result = self.manager.gitlab.http_get( - path, streamed=streamed, raw=True, **kwargs - ) - return utils.response_content(result, streamed, action, chunk_size) - class ProjectExportManager(GetWithoutIdMixin, CreateMixin, RESTManager): _path = "/projects/%(project_id)s/export" |