Revoke Gitlab blocked users from groups using Python

Hi,

I’m not sure if this is the right place for this kind of question but I’ll try my luck. :slight_smile: For audit purposes I’m trying to revoke/remove all blocked users from groups using a Python script. Until now I managed just to list all blocked users in my Gitlab instance using a simple curl: curl -H "Private-Token: xxx” https://mygitlab.domain.com/api/v3/users?blocked=true . Can anyone point me to the right direction for a list with the groups, blocked users\group and how to revoke them using Gitlab API and Python. Any suggestion would be appreciated.

Thank you

1 Like

Hi,

you seem to be using a really old version of GitLab with using the v3 API which has been removed in 12.x AFAIK. I would recommend to upgrade GitLab, use the v4 API and look into the Python library which has great abstracted key bindings: https://python-gitlab.readthedocs.io/en/stable/

Cheers,
Michael

1 Like