Python GitLab Module Install
pip install python-gitlab
GitLab Login
import gitlab
gl = gitlab.Gitlab('URL', private_token='Token')
Get the list of users
users = gl.users.list()
users = gl.users.list(search='foo')
# by ID
user = gl.users.get(user_id)
# by username
user = gl.users.list(username='root')[0]
Create a user
user = gl.users.create({'email': 'test@hi.com',
'password': 'pass',
'username': 'test',
'name': 'test test'})
Update a user
user.name = 'Real Name'
user.save()
Delete a user
gl.users.delete(user_id)
# or
user.delete()
Block/Unblock a user
user.block()
user.unblock()
Activate/Deactivate a user
user.activate()
user.deactivate()'IT > Python' 카테고리의 다른 글
| Python PowerShell (0) | 2021.01.14 |
|---|---|
| Real-time Python Jenkins Build Status Check (0) | 2021.01.14 |
| Python Url Monitor (0) | 2021.01.13 |
| Python System Info (0) | 2021.01.13 |
| Python Jenkins Module Install (0) | 2021.01.13 |