From 28eb7eab8fbe3750fb56e85967e8179b7025f441 Mon Sep 17 00:00:00 2001 From: Florian <7816109+Flor1an-dev@users.noreply.github.com> Date: Thu, 16 Apr 2020 13:54:34 +0200 Subject: [PATCH] feat(api): added support in the GroupManager to upload Group avatars --- docs/gl_objects/groups.rst | 7 +++++++ gitlab/v4/objects.py | 1 + 2 files changed, 8 insertions(+) diff --git a/docs/gl_objects/groups.rst b/docs/gl_objects/groups.rst index d3e4d927d..02d2bb097 100644 --- a/docs/gl_objects/groups.rst +++ b/docs/gl_objects/groups.rst @@ -61,6 +61,13 @@ Update a group:: group.description = 'My awesome group' group.save() +Set the avatar image for a group:: + + # the avatar image can be passed as data (content of the file) or as a file + # object opened in binary mode + group.avatar = open('path/to/file.png', 'rb') + group.save() + Remove a group:: gl.groups.delete(group_id) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 29b10fc1d..0e6056c12 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1513,6 +1513,7 @@ class GroupManager(CRUDMixin, RESTManager): "default_branch_protection", ), ) + _types = {"avatar": types.ImageAttribute} @exc.on_http_error(exc.GitlabImportError) def import_group(self, file, path, name, parent_id=None, **kwargs):