Skip to content

Block a user with the Gitlab API + python-gitlab #88

@ghost

Description

Hi Gauvain,

Is it possible to block a user with python-gitlab ?

This feature is already available in pyapi-gitlab:

    def blockuser(self, user_id, **kwargs):
        """Block a user.
        :param user_id: id of the user to change
        :param kwargs: Any param the the Gitlab API supports
        :return: Dict of the user
        """
        data = {}

        if kwargs:
            data.update(kwargs)

        request = requests.put("{0}/{1}/block".format(self.users_url, user_id),
                               headers=self.headers, data=data,
                               timeout=self.timeout,
                               verify=self.verify_ssl)
        if request.status_code == 200:
            return request.json()
        else:
            return False

Thank you.

Asher256

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions