gitlab.v3 package

Submodules

gitlab.v3.objects module

class gitlab.v3.objects.ApplicationSettings(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • after_sign_out_path (optional)
  • container_registry_token_expire_delay (optional)
  • default_branch_protection (optional)
  • default_project_visibility (optional)
  • default_projects_limit (optional)
  • default_snippet_visibility (optional)
  • domain_blacklist (optional)
  • domain_blacklist_enabled (optional)
  • domain_whitelist (optional)
  • enabled_git_access_protocol (optional)
  • gravatar_enabled (optional)
  • home_page_url (optional)
  • max_attachment_size (optional)
  • repository_storage (optional)
  • restricted_signup_domains (optional)
  • restricted_visibility_levels (optional)
  • session_expire_delay (optional)
  • sign_in_text (optional)
  • signin_enabled (optional)
  • signup_enabled (optional)
  • twitter_sharing_enabled (optional)
  • user_oauth_applications (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canCreate = False
canDelete = False
canList = False
getRequiresId = False
optionalUpdateAttrs = ['after_sign_out_path', 'container_registry_token_expire_delay', 'default_branch_protection', 'default_project_visibility', 'default_projects_limit', 'default_snippet_visibility', 'domain_blacklist', 'domain_blacklist_enabled', 'domain_whitelist', 'enabled_git_access_protocol', 'gravatar_enabled', 'home_page_url', 'max_attachment_size', 'repository_storage', 'restricted_signup_domains', 'restricted_visibility_levels', 'session_expire_delay', 'sign_in_text', 'signin_enabled', 'signup_enabled', 'twitter_sharing_enabled', 'user_oauth_applications']
class gitlab.v3.objects.ApplicationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ApplicationSettings’> objects.

<class ‘gitlab.v3.objects.ApplicationSettings’> objects can be updated.

get(**kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ApplicationSettings’>.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ApplicationSettings

class gitlab.v3.objects.BroadcastMessage(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • message (optional)
  • starts_at (optional)
  • ends_at (optional)
  • color (optional)
  • font (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
optionalCreateAttrs = ['starts_at', 'ends_at', 'color', 'font']
optionalUpdateAttrs = ['message', 'starts_at', 'ends_at', 'color', 'font']
requiredCreateAttrs = ['message']
requiredUpdateAttrs = []
class gitlab.v3.objects.BroadcastMessageManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.BroadcastMessage’> objects.

<class ‘gitlab.v3.objects.BroadcastMessage’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.BroadcastMessage’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.BroadcastMessage’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.BroadcastMessage’>.

data is a dict defining the object attributes. Available attributes are:

  • message (required)
  • starts_at (optional)
  • ends_at (optional)
  • color (optional)
  • font (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of BroadcastMessage

class gitlab.v3.objects.CurrentUser(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canList = False
canUpdate = False
managers = (('emails', 'CurrentUserEmailManager', [('user_id', 'id')]), ('keys', 'CurrentUserKeyManager', [('user_id', 'id')]))
shortPrintAttr = 'username'
class gitlab.v3.objects.CurrentUserEmail(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['email']
shortPrintAttr = 'email'
class gitlab.v3.objects.CurrentUserEmailManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.CurrentUserEmail’> objects.

<class ‘gitlab.v3.objects.CurrentUserEmail’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.CurrentUserEmail’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.CurrentUserEmail’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.CurrentUserEmail’>.

data is a dict defining the object attributes. Available attributes are:

  • email (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of CurrentUserEmail

class gitlab.v3.objects.CurrentUserKey(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['title', 'key']
shortPrintAttr = 'title'
class gitlab.v3.objects.CurrentUserKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.CurrentUserKey’> objects.

<class ‘gitlab.v3.objects.CurrentUserKey’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.CurrentUserKey’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.CurrentUserKey’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.CurrentUserKey’>.

data is a dict defining the object attributes. Available attributes are:

  • title (required)
  • key (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of CurrentUserKey

class gitlab.v3.objects.DeployKey(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canGet = 'from_list'
canUpdate = False
class gitlab.v3.objects.DeployKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.DeployKey’> objects.

<class ‘gitlab.v3.objects.DeployKey’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.DeployKey’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.DeployKey’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of DeployKey

class gitlab.v3.objects.Gitignore(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canUpdate = False
idAttr = 'name'
class gitlab.v3.objects.GitignoreManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Gitignore’> objects.

<class ‘gitlab.v3.objects.Gitignore’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Gitignore’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Gitignore’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Gitignore

class gitlab.v3.objects.Gitlabciyml(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canUpdate = False
idAttr = 'name'
class gitlab.v3.objects.GitlabciymlManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Gitlabciyml’> objects.

<class ‘gitlab.v3.objects.Gitlabciyml’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Gitlabciyml’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Gitlabciyml’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Gitlabciyml

class gitlab.v3.objects.Group(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

accessrequests

GroupAccessRequestManager - Manager for objects.

members

GroupMemberManager - Manager for objects.

notificationsettings

GroupNotificationSettingsManager - Manager for objects.

projects

GroupProjectManager - Manager for objects.

issues

GroupIssueManager - Manager for objects.

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • name (optional)
  • path (optional)
  • description (optional)
  • visibility_level (optional)
  • lfs_enabled (optional)
  • request_access_enabled (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
DEVELOPER_ACCESS = 30
GUEST_ACCESS = 10
MASTER_ACCESS = 40
OWNER_ACCESS = 50
REPORTER_ACCESS = 20
VISIBILITY_INTERNAL = 10
VISIBILITY_PRIVATE = 0
VISIBILITY_PUBLIC = 20
managers = (('accessrequests', 'GroupAccessRequestManager', [('group_id', 'id')]), ('members', 'GroupMemberManager', [('group_id', 'id')]), ('notificationsettings', 'GroupNotificationSettingsManager', [('group_id', 'id')]), ('projects', 'GroupProjectManager', [('group_id', 'id')]), ('issues', 'GroupIssueManager', [('group_id', 'id')]))
optionalCreateAttrs = ['description', 'visibility_level', 'parent_id', 'lfs_enabled', 'request_access_enabled']
optionalUpdateAttrs = ['name', 'path', 'description', 'visibility_level', 'lfs_enabled', 'request_access_enabled']
requiredCreateAttrs = ['name', 'path']
shortPrintAttr = 'name'
transfer_project(id, **kwargs)

Transfers a project to this new groups.

Parameters:

id (int) – ID of the project to transfer.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabTransferProjectError – If the server fails to perform the request.
class gitlab.v3.objects.GroupAccessRequest(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

approve(access_level=30, **kwargs)

Approve an access request.

Parameters:

access_level (int) – The access level for the user.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabUpdateError – If the server fails to perform the request.
canGet = 'from_list'
canUpdate = False
class gitlab.v3.objects.GroupAccessRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.GroupAccessRequest’> objects.

<class ‘gitlab.v3.objects.GroupAccessRequest’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.GroupAccessRequest’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.GroupAccessRequest’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.GroupAccessRequest’>.

data is a dict defining the object attributes. Available attributes are:

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of GroupAccessRequest

class gitlab.v3.objects.GroupIssue(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canGet = 'from_list'
canUpdate = False
optionalListAttrs = ['state', 'labels', 'milestone', 'order_by', 'sort']
requiredUrlAttrs = ['group_id']
class gitlab.v3.objects.GroupIssueManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.GroupIssue’> objects.

<class ‘gitlab.v3.objects.GroupIssue’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.GroupIssue’>.

Available keys for kwargs are:

  • state (optional)
  • labels (optional)
  • milestone (optional)
  • order_by (optional)
  • sort (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.GroupIssue’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of GroupIssue

class gitlab.v3.objects.GroupManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Group’> objects.

<class ‘gitlab.v3.objects.Group’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Group’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Group’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.Group’>.

data is a dict defining the object attributes. Available attributes are:

  • name (required)
  • path (required)
  • description (optional)
  • visibility_level (optional)
  • parent_id (optional)
  • lfs_enabled (optional)
  • request_access_enabled (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Group

search(query, **kwargs)

Searches groups by name.

Parameters:
  • query (str) – The search string
  • all (bool) – If True, return all the items, without pagination
Returns:

a list of matching groups.

Return type:

list(Group)

class gitlab.v3.objects.GroupMember(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • access_level (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canGet = 'from_list'
optionalCreateAttrs = ['expires_at']
requiredCreateAttrs = ['access_level', 'user_id']
requiredUpdateAttrs = ['access_level']
requiredUrlAttrs = ['group_id']
shortPrintAttr = 'username'
class gitlab.v3.objects.GroupMemberManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.GroupMember’> objects.

<class ‘gitlab.v3.objects.GroupMember’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.GroupMember’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.GroupMember’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.GroupMember’>.

data is a dict defining the object attributes. Available attributes are:

  • group_id (required if not discovered on the parent objects)
  • access_level (required)
  • user_id (required)
  • expires_at (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of GroupMember

class gitlab.v3.objects.GroupNotificationSettings(gl, data=None, **kwargs)

Bases: gitlab.v3.objects.NotificationSettings

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • level (optional)
  • notification_email (optional)
  • new_note (optional)
  • new_issue (optional)
  • reopen_issue (optional)
  • close_issue (optional)
  • reassign_issue (optional)
  • new_merge_request (optional)
  • reopen_merge_request (optional)
  • close_merge_request (optional)
  • reassign_merge_request (optional)
  • merge_merge_request (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
requiredUrlAttrs = ['group_id']
class gitlab.v3.objects.GroupNotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.GroupNotificationSettings’> objects.

<class ‘gitlab.v3.objects.GroupNotificationSettings’> objects can be updated.

get(**kwargs)

Get a single object of type <class ‘gitlab.v3.objects.GroupNotificationSettings’>.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of GroupNotificationSettings

class gitlab.v3.objects.GroupProject(*args, **kwargs)

Bases: gitlab.v3.objects.Project

canCreate = False
canDelete = False
canGet = 'from_list'
canUpdate = False
optionalListAttrs = ['archived', 'visibility', 'order_by', 'sort', 'search', 'ci_enabled_first']
class gitlab.v3.objects.GroupProjectManager(gl, parent=None, args=[])

Bases: gitlab.v3.objects.ProjectManager

Manager for <class ‘gitlab.v3.objects.GroupProject’> objects.

<class ‘gitlab.v3.objects.GroupProject’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.GroupProject’>.

Available keys for kwargs are:

  • archived (optional)
  • visibility (optional)
  • order_by (optional)
  • sort (optional)
  • search (optional)
  • ci_enabled_first (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.GroupProject’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of GroupProject

class gitlab.v3.objects.Hook(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['url']
shortPrintAttr = 'url'
class gitlab.v3.objects.HookManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Hook’> objects.

<class ‘gitlab.v3.objects.Hook’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Hook’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Hook’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.Hook’>.

data is a dict defining the object attributes. Available attributes are:

  • url (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Hook

class gitlab.v3.objects.Issue(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canGet = 'from_list'
canUpdate = False
optionalListAttrs = ['state', 'labels', 'order_by', 'sort']
shortPrintAttr = 'title'
class gitlab.v3.objects.IssueManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Issue’> objects.

<class ‘gitlab.v3.objects.Issue’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Issue’>.

Available keys for kwargs are:

  • state (optional)
  • labels (optional)
  • order_by (optional)
  • sort (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Issue’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Issue

class gitlab.v3.objects.License(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canUpdate = False
idAttr = 'key'
optionalGetAttrs = ['project', 'fullname']
optionalListAttrs = ['popular']
class gitlab.v3.objects.LicenseManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.License’> objects.

<class ‘gitlab.v3.objects.License’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.License’>.

Available keys for kwargs are:

  • popular (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.License’> using its id.

Available keys for kwargs are:

  • project (optional)
  • fullname (optional)
  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of License

class gitlab.v3.objects.Namespace(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canGet = 'from_list'
canUpdate = False
optionalListAttrs = ['search']
class gitlab.v3.objects.NamespaceManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Namespace’> objects.

<class ‘gitlab.v3.objects.Namespace’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Namespace’>.

Available keys for kwargs are:

  • search (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Namespace’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Namespace

class gitlab.v3.objects.NotificationSettings(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • level (optional)
  • notification_email (optional)
  • new_note (optional)
  • new_issue (optional)
  • reopen_issue (optional)
  • close_issue (optional)
  • reassign_issue (optional)
  • new_merge_request (optional)
  • reopen_merge_request (optional)
  • close_merge_request (optional)
  • reassign_merge_request (optional)
  • merge_merge_request (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canCreate = False
canDelete = False
canList = False
getRequiresId = False
optionalUpdateAttrs = ['level', 'notification_email', 'new_note', 'new_issue', 'reopen_issue', 'close_issue', 'reassign_issue', 'new_merge_request', 'reopen_merge_request', 'close_merge_request', 'reassign_merge_request', 'merge_merge_request']
class gitlab.v3.objects.NotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.NotificationSettings’> objects.

<class ‘gitlab.v3.objects.NotificationSettings’> objects can be updated.

get(**kwargs)

Get a single object of type <class ‘gitlab.v3.objects.NotificationSettings’>.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of NotificationSettings

class gitlab.v3.objects.Project(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

accessrequests

ProjectAccessRequestManager - Manager for objects.

boards

ProjectBoardManager - Manager for objects.

board_lists

ProjectBoardListManager - Manager for objects.

branches

ProjectBranchManager - Manager for objects.

builds

ProjectBuildManager - Manager for objects.

commits

ProjectCommitManager - Manager for objects.

deployments

ProjectDeploymentManager - Manager for objects.

environments

ProjectEnvironmentManager - Manager for objects.

events

ProjectEventManager - Manager for objects.

files

ProjectFileManager - Manager for objects.

forks

ProjectForkManager - Manager for objects.

hooks

ProjectHookManager - Manager for objects.

keys

ProjectKeyManager - Manager for objects.

issues

ProjectIssueManager - Manager for objects.

labels

ProjectLabelManager - Manager for objects.

members

ProjectMemberManager - Manager for objects.

mergerequests

ProjectMergeRequestManager - Manager for objects.

milestones

ProjectMilestoneManager - Manager for objects.

notes

ProjectNoteManager - Manager for objects.

notificationsettings

ProjectNotificationSettingsManager - Manager for objects.

pipelines

ProjectPipelineManager - Manager for objects.

runners

ProjectRunnerManager - Manager for objects.

services

ProjectServiceManager - Manager for objects.

snippets

ProjectSnippetManager - Manager for objects.

tags

ProjectTagManager - Manager for objects.

triggers

ProjectTriggerManager - Manager for objects.

variables

ProjectVariableManager - Manager for objects.

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • name (optional)
  • path (optional)
  • default_branch (optional)
  • description (optional)
  • issues_enabled (optional)
  • merge_requests_enabled (optional)
  • builds_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • container_registry_enabled (optional)
  • shared_runners_enabled (optional)
  • public (optional)
  • visibility_level (optional)
  • import_url (optional)
  • public_builds (optional)
  • only_allow_merge_if_build_succeeds (optional)
  • only_allow_merge_if_all_discussions_are_resolved (optional)
  • lfs_enabled (optional)
  • request_access_enabled (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
VISIBILITY_INTERNAL = 10
VISIBILITY_PRIVATE = 0
VISIBILITY_PUBLIC = 20
archive(**kwargs)

Archive a project.

Returns:

the updated Project

Return type:

Project

Raises:
  • GitlabCreateError – If the action cannot be done
  • GitlabConnectionError – If the server cannot be reached.
create_fork_relation(forked_from_id)

Create a forked from/to relation between existing projects.

Parameters:

forked_from_id (int) – The ID of the project that was forked from

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabCreateError – If the server fails to perform the request.
delete_fork_relation()

Delete a forked relation between existing projects.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabDeleteError – If the server fails to perform the request.
managers = (('accessrequests', 'ProjectAccessRequestManager', [('project_id', 'id')]), ('boards', 'ProjectBoardManager', [('project_id', 'id')]), ('board_lists', 'ProjectBoardListManager', [('project_id', 'id')]), ('branches', 'ProjectBranchManager', [('project_id', 'id')]), ('builds', 'ProjectBuildManager', [('project_id', 'id')]), ('commits', 'ProjectCommitManager', [('project_id', 'id')]), ('deployments', 'ProjectDeploymentManager', [('project_id', 'id')]), ('environments', 'ProjectEnvironmentManager', [('project_id', 'id')]), ('events', 'ProjectEventManager', [('project_id', 'id')]), ('files', 'ProjectFileManager', [('project_id', 'id')]), ('forks', 'ProjectForkManager', [('project_id', 'id')]), ('hooks', 'ProjectHookManager', [('project_id', 'id')]), ('keys', 'ProjectKeyManager', [('project_id', 'id')]), ('issues', 'ProjectIssueManager', [('project_id', 'id')]), ('labels', 'ProjectLabelManager', [('project_id', 'id')]), ('members', 'ProjectMemberManager', [('project_id', 'id')]), ('mergerequests', 'ProjectMergeRequestManager', [('project_id', 'id')]), ('milestones', 'ProjectMilestoneManager', [('project_id', 'id')]), ('notes', 'ProjectNoteManager', [('project_id', 'id')]), ('notificationsettings', 'ProjectNotificationSettingsManager', [('project_id', 'id')]), ('pipelines', 'ProjectPipelineManager', [('project_id', 'id')]), ('runners', 'ProjectRunnerManager', [('project_id', 'id')]), ('services', 'ProjectServiceManager', [('project_id', 'id')]), ('snippets', 'ProjectSnippetManager', [('project_id', 'id')]), ('tags', 'ProjectTagManager', [('project_id', 'id')]), ('triggers', 'ProjectTriggerManager', [('project_id', 'id')]), ('variables', 'ProjectVariableManager', [('project_id', 'id')]))
optionalCreateAttrs = ['path', 'namespace_id', 'description', 'issues_enabled', 'merge_requests_enabled', 'builds_enabled', 'wiki_enabled', 'snippets_enabled', 'container_registry_enabled', 'shared_runners_enabled', 'public', 'visibility_level', 'import_url', 'public_builds', 'only_allow_merge_if_build_succeeds', 'only_allow_merge_if_all_discussions_are_resolved', 'lfs_enabled', 'request_access_enabled']
optionalListAttrs = ['search']
optionalUpdateAttrs = ['name', 'path', 'default_branch', 'description', 'issues_enabled', 'merge_requests_enabled', 'builds_enabled', 'wiki_enabled', 'snippets_enabled', 'container_registry_enabled', 'shared_runners_enabled', 'public', 'visibility_level', 'import_url', 'public_builds', 'only_allow_merge_if_build_succeeds', 'only_allow_merge_if_all_discussions_are_resolved', 'lfs_enabled', 'request_access_enabled']
repository_archive(sha=None, streamed=False, action=None, chunk_size=1024, **kwargs)

Return a tarball of the repository.

Parameters:
  • sha (str) – ID of the commit (default branch by default).
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The binary data of the archive.

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
repository_blob(sha, filepath, streamed=False, action=None, chunk_size=1024, **kwargs)

Return the content of a file for a commit.

Parameters:
  • sha (str) – ID of the commit
  • filepath (str) – Path of the file to return
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The file content

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
repository_compare(from_, to, **kwargs)

Returns a diff between two branches/commits.

Parameters:
  • from (str) – orig branch/SHA
  • to (str) – dest branch/SHA
Returns:

The diff

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
repository_contributors()

Returns a list of contributors for the project.

Returns:

The contibutors

Return type:

list

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
repository_raw_blob(sha, streamed=False, action=None, chunk_size=1024, **kwargs)

Returns the raw file contents for a blob by blob SHA.

Parameters:
  • sha (str) – ID of the blob
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The blob content

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
repository_tree(path='', ref_name='', **kwargs)

Return a list of files in the repository.

Parameters:
  • path (str) – Path of the top folder (/ by default)
  • ref_name (str) – Reference to a commit or branch
Returns:

The json representation of the tree.

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
requiredCreateAttrs = ['name']
share(group_id, group_access, **kwargs)

Share the project with a group.

Parameters:
  • group_id (int) – ID of the group.
  • group_access (int) – Access level for the group.
Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabCreateError – If the server fails to perform the request.
shortPrintAttr = 'path'
star(**kwargs)

Star a project.

Returns:

the updated Project

Return type:

Project

Raises:
  • GitlabCreateError – If the action cannot be done
  • GitlabConnectionError – If the server cannot be reached.
trigger_build(ref, token, variables={}, **kwargs)

Trigger a CI build.

See https://gitlab.com/help/ci/triggers/README.md#trigger-a-build

Parameters:
  • ref (str) – Commit to build; can be a commit SHA, a branch name, …
  • token (str) – The trigger token
  • variables (dict) – Variables passed to the build script
Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabCreateError – If the server fails to perform the request.
unarchive(**kwargs)

Unarchive a project.

Returns:

the updated Project

Return type:

Project

Raises:
  • GitlabDeleteError – If the action cannot be done
  • GitlabConnectionError – If the server cannot be reached.
unshare(group_id, **kwargs)

Delete a shared project link within a group.

Parameters:

group_id (int) – ID of the group.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabDeleteError – If the server fails to perform the request.
unstar(**kwargs)

Unstar a project.

Returns:

the updated Project

Return type:

Project

Raises:
  • GitlabDeleteError – If the action cannot be done
  • GitlabConnectionError – If the server cannot be reached.
upload(filename, filedata=None, filepath=None, **kwargs)

Upload the specified file into the project.

Note

Either filedata or filepath MUST be specified.

Parameters:
  • filename (str) – The name of the file being uploaded
  • filedata (bytes) – The raw data of the file being uploaded
  • filepath (str) – The path to a local file to upload (optional)
Raises:
  • GitlabConnectionError – If the server cannot be reached
  • GitlabUploadError – If the file upload fails
  • GitlabUploadError – If filedata and filepath are not specified
  • GitlabUploadError – If both filedata and filepath are specified
Returns:

A dict with the keys:
  • alt - The alternate text for the upload
  • url - The direct url to the uploaded file
  • markdown - Markdown for the uploaded file

Return type:

dict

class gitlab.v3.objects.ProjectAccessRequest(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

approve(access_level=30, **kwargs)

Approve an access request.

Parameters:

access_level (int) – The access level for the user.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabUpdateError – If the server fails to perform the request.
canGet = 'from_list'
canUpdate = False
class gitlab.v3.objects.ProjectAccessRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectAccessRequest’> objects.

<class ‘gitlab.v3.objects.ProjectAccessRequest’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectAccessRequest’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectAccessRequest’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectAccessRequest’>.

data is a dict defining the object attributes. Available attributes are:

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectAccessRequest

class gitlab.v3.objects.ProjectBoard(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canGet = 'from_list'
canUpdate = False
managers = (('lists', 'ProjectBoardListManager', [('project_id', 'project_id'), ('board_id', 'id')]),)
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectBoardList(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • position (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
requiredCreateAttrs = ['label_id']
requiredUpdateAttrs = ['position']
requiredUrlAttrs = ['project_id', 'board_id']
class gitlab.v3.objects.ProjectBoardListManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectBoardList’> objects.

<class ‘gitlab.v3.objects.ProjectBoardList’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectBoardList’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectBoardList’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectBoardList’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • board_id (required if not discovered on the parent objects)
  • label_id (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectBoardList

class gitlab.v3.objects.ProjectBoardManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectBoard’> objects.

<class ‘gitlab.v3.objects.ProjectBoard’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectBoard’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectBoard’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectBoard

class gitlab.v3.objects.ProjectBranch(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
idAttr = 'name'
protect(protect=True, **kwargs)

Protects the branch.

requiredCreateAttrs = ['branch_name', 'ref']
requiredUrlAttrs = ['project_id']
unprotect(**kwargs)

Unprotects the branch.

class gitlab.v3.objects.ProjectBranchManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectBranch’> objects.

<class ‘gitlab.v3.objects.ProjectBranch’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectBranch’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectBranch’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectBranch’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • branch_name (required)
  • ref (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectBranch

class gitlab.v3.objects.ProjectBuild(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

artifacts(streamed=False, action=None, chunk_size=1024, **kwargs)

Get the build artifacts.

Parameters:
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The artifacts if streamed is False, None otherwise.

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the artifacts are not available.
canCreate = False
canDelete = False
canUpdate = False
cancel(**kwargs)

Cancel the build.

erase(**kwargs)

Erase the build (remove build artifacts and trace).

keep_artifacts(**kwargs)

Prevent artifacts from being delete when expiration is set.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabCreateError – If the request failed.
play(**kwargs)

Trigger a build explicitly.

requiredUrlAttrs = ['project_id']
retry(**kwargs)

Retry the build.

trace(streamed=False, action=None, chunk_size=1024, **kwargs)

Get the build trace.

Parameters:
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The trace.

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the trace is not available.
class gitlab.v3.objects.ProjectBuildManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectBuild’> objects.

<class ‘gitlab.v3.objects.ProjectBuild’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectBuild’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectBuild’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectBuild

class gitlab.v3.objects.ProjectCommit(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

blob(filepath, streamed=False, action=None, chunk_size=1024, **kwargs)

Generate the content of a file for this commit.

Parameters:
  • filepath (str) – Path of the file to request.
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The content of the file

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
builds(**kwargs)

List the build for this commit.

Returns:

A list of builds.

Return type:

list(ProjectBuild)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabListError – If the server fails to perform the request.
canDelete = False
canUpdate = False
cherry_pick(branch, **kwargs)

Cherry-pick a commit into a branch.

Parameters:branch (str) – Name of target branch.
Raises:GitlabCherryPickError – If the cherry pick could not be applied.
diff(**kwargs)

Generate the commit diff.

managers = (('comments', 'ProjectCommitCommentManager', [('project_id', 'project_id'), ('commit_id', 'id')]), ('statuses', 'ProjectCommitStatusManager', [('project_id', 'project_id'), ('commit_id', 'id')]))
optionalCreateAttrs = ['author_email', 'author_name']
requiredCreateAttrs = ['branch_name', 'commit_message', 'actions']
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'title'
class gitlab.v3.objects.ProjectCommitComment(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canDelete = False
canGet = False
canUpdate = False
optionalCreateAttrs = ['path', 'line', 'line_type']
requiredCreateAttrs = ['note']
requiredUrlAttrs = ['project_id', 'commit_id']
class gitlab.v3.objects.ProjectCommitCommentManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectCommitComment’> objects.

<class ‘gitlab.v3.objects.ProjectCommitComment’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectCommitComment’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectCommitComment’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • commit_id (required if not discovered on the parent objects)
  • note (required)
  • path (optional)
  • line (optional)
  • line_type (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectCommitComment

class gitlab.v3.objects.ProjectCommitManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectCommit’> objects.

<class ‘gitlab.v3.objects.ProjectCommit’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectCommit’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectCommit’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectCommit’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • branch_name (required)
  • commit_message (required)
  • actions (required)
  • author_email (optional)
  • author_name (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectCommit

class gitlab.v3.objects.ProjectCommitStatus(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canDelete = False
canUpdate = False
optionalCreateAttrs = ['description', 'name', 'context', 'ref', 'target_url']
optionalGetAttrs = ['ref_name', 'stage', 'name', 'all']
requiredCreateAttrs = ['state']
requiredUrlAttrs = ['project_id', 'commit_id']
class gitlab.v3.objects.ProjectCommitStatusManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectCommitStatus’> objects.

<class ‘gitlab.v3.objects.ProjectCommitStatus’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectCommitStatus’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectCommitStatus’> using its id.

Available keys for kwargs are:

  • ref_name (optional)
  • stage (optional)
  • name (optional)
  • all (optional)
  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectCommitStatus’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • commit_id (required if not discovered on the parent objects)
  • state (required)
  • description (optional)
  • name (optional)
  • context (optional)
  • ref (optional)
  • target_url (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectCommitStatus

class gitlab.v3.objects.ProjectDeployment(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canUpdate = False
class gitlab.v3.objects.ProjectDeploymentManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectDeployment’> objects.

<class ‘gitlab.v3.objects.ProjectDeployment’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectDeployment’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectDeployment’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectDeployment

class gitlab.v3.objects.ProjectEnvironment(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • name (optional)
  • external_url (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canGet = 'from_list'
optionalCreateAttrs = ['external_url']
optionalUpdateAttrs = ['name', 'external_url']
requiredCreateAttrs = ['name']
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectEnvironmentManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectEnvironment’> objects.

<class ‘gitlab.v3.objects.ProjectEnvironment’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectEnvironment’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectEnvironment’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectEnvironment’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • name (required)
  • external_url (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectEnvironment

class gitlab.v3.objects.ProjectEvent(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canGet = 'from_list'
canUpdate = False
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'target_title'
class gitlab.v3.objects.ProjectEventManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectEvent’> objects.

<class ‘gitlab.v3.objects.ProjectEvent’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectEvent’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectEvent’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectEvent

class gitlab.v3.objects.ProjectFile(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • file_path (required)
  • branch_name (required)
  • content (required)
  • commit_message (required)
  • encoding (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canList = False
decode()

Returns the decoded content of the file.

Returns:the decoded content.
Return type:(str)
getRequiresId = False
optionalCreateAttrs = ['encoding']
requiredCreateAttrs = ['file_path', 'branch_name', 'content', 'commit_message']
requiredDeleteAttrs = ['branch_name', 'commit_message', 'file_path']
requiredGetAttrs = ['file_path', 'ref']
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'file_path'
class gitlab.v3.objects.ProjectFileManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectFile’> objects.

<class ‘gitlab.v3.objects.ProjectFile’> objects can be updated.

get(**kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectFile’>.

Available keys for kwargs are:

  • file_path (required)
  • ref (required)
  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectFile’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • file_path (required)
  • branch_name (required)
  • content (required)
  • commit_message (required)
  • encoding (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectFile

class gitlab.v3.objects.ProjectFork(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canDelete = False
canGet = False
canList = False
canUpdate = False
optionalCreateAttrs = ['namespace']
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectForkManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectFork’> objects.

<class ‘gitlab.v3.objects.ProjectFork’> objects cannot be updated.

create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectFork’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • namespace (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectFork

class gitlab.v3.objects.ProjectHook(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • url (required)
  • push_events (optional)
  • issues_events (optional)
  • note_events (optional)
  • merge_requests_events (optional)
  • tag_push_events (optional)
  • build_events (optional)
  • enable_ssl_verification (optional)
  • token (optional)
  • pipeline_events (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
optionalCreateAttrs = ['push_events', 'issues_events', 'note_events', 'merge_requests_events', 'tag_push_events', 'build_events', 'enable_ssl_verification', 'token', 'pipeline_events']
requiredCreateAttrs = ['url']
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'url'
class gitlab.v3.objects.ProjectHookManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectHook’> objects.

<class ‘gitlab.v3.objects.ProjectHook’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectHook’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectHook’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectHook’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • url (required)
  • push_events (optional)
  • issues_events (optional)
  • note_events (optional)
  • merge_requests_events (optional)
  • tag_push_events (optional)
  • build_events (optional)
  • enable_ssl_verification (optional)
  • token (optional)
  • pipeline_events (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectHook

class gitlab.v3.objects.ProjectIssue(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

notes

ProjectIssueNoteManager - Manager for objects.

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • title (optional)
  • description (optional)
  • assignee_id (optional)
  • milestone_id (optional)
  • labels (optional)
  • created_at (optional)
  • updated_at (optional)
  • state_event (optional)
  • due_date (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
add_spent_time(**kwargs)

Set an estimated time of work for the issue.

Raises:GitlabConnectionError – If the server cannot be reached.
description_attr = 'description'
managers = (('notes', 'ProjectIssueNoteManager', [('project_id', 'project_id'), ('issue_id', 'id')]),)
move(to_project_id, **kwargs)

Move the issue to another project.

Raises:GitlabConnectionError – If the server cannot be reached.
optionalCreateAttrs = ['description', 'assignee_id', 'milestone_id', 'labels', 'created_at', 'due_date']
optionalListAttrs = ['state', 'labels', 'milestone', 'iid', 'order_by', 'sort']
optionalUpdateAttrs = ['title', 'description', 'assignee_id', 'milestone_id', 'labels', 'created_at', 'updated_at', 'state_event', 'due_date']
project_id_attr = 'project_id'
requiredCreateAttrs = ['title']
requiredUrlAttrs = ['project_id']
reset_spent_time(**kwargs)

Set an estimated time of work for the issue.

Raises:GitlabConnectionError – If the server cannot be reached.
reset_time_estimate(**kwargs)

Resets estimated time for the issue to 0 seconds.

Raises:GitlabConnectionError – If the server cannot be reached.
shortPrintAttr = 'title'
subscribe(**kwargs)

Subscribe to an issue.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabSubscribeError – If the subscription cannot be done
time_estimate(**kwargs)

Set an estimated time of work for the issue.

Raises:GitlabConnectionError – If the server cannot be reached.
time_stats(**kwargs)

Get time stats for the issue.

Raises:GitlabConnectionError – If the server cannot be reached.
todo(**kwargs)

Create a todo for the issue.

Raises:GitlabConnectionError – If the server cannot be reached.
unsubscribe(**kwargs)

Unsubscribe an issue.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabUnsubscribeError – If the unsubscription cannot be done
class gitlab.v3.objects.ProjectIssueManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectIssue’> objects.

<class ‘gitlab.v3.objects.ProjectIssue’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectIssue’>.

Available keys for kwargs are:

  • state (optional)
  • labels (optional)
  • milestone (optional)
  • iid (optional)
  • order_by (optional)
  • sort (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectIssue’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectIssue’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • title (required)
  • description (optional)
  • assignee_id (optional)
  • milestone_id (optional)
  • labels (optional)
  • created_at (optional)
  • due_date (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectIssue

class gitlab.v3.objects.ProjectIssueNote(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • body (required)
  • created_at (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canDelete = False
description_attr = 'body'
optionalCreateAttrs = ['created_at']
project_id_attr = 'project_id'
requiredCreateAttrs = ['body']
requiredUrlAttrs = ['project_id', 'issue_id']
class gitlab.v3.objects.ProjectIssueNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectIssueNote’> objects.

<class ‘gitlab.v3.objects.ProjectIssueNote’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectIssueNote’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectIssueNote’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectIssueNote’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • issue_id (required if not discovered on the parent objects)
  • body (required)
  • created_at (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectIssueNote

class gitlab.v3.objects.ProjectKey(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['title', 'key']
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectKey’> objects.

<class ‘gitlab.v3.objects.ProjectKey’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectKey’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectKey’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectKey’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • title (required)
  • key (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
disable(key_id)

Disable a deploy key for a project.

enable(key_id)

Enable a deploy key for a project.

obj_cls

alias of ProjectKey

class gitlab.v3.objects.ProjectLabel(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • name (required)
  • new_name (optional)
  • color (optional)
  • description (optional)
  • priority (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canGet = 'from_list'
idAttr = 'name'
optionalCreateAttrs = ['description', 'priority']
optionalUpdateAttrs = ['new_name', 'color', 'description', 'priority']
requiredCreateAttrs = ['name', 'color']
requiredDeleteAttrs = ['name']
requiredUpdateAttrs = ['name']
requiredUrlAttrs = ['project_id']
subscribe(**kwargs)

Subscribe to a label.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabSubscribeError – If the subscription cannot be done
unsubscribe(**kwargs)

Unsubscribe a label.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabUnsubscribeError – If the unsubscription cannot be done
class gitlab.v3.objects.ProjectLabelManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectLabel’> objects.

<class ‘gitlab.v3.objects.ProjectLabel’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectLabel’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectLabel’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectLabel’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • name (required)
  • color (required)
  • description (optional)
  • priority (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectLabel

class gitlab.v3.objects.ProjectManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Project’> objects.

<class ‘gitlab.v3.objects.Project’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Project’>.

Available keys for kwargs are:

  • search (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Project’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.Project’>.

data is a dict defining the object attributes. Available attributes are:

  • name (required)
  • path (optional)
  • namespace_id (optional)
  • description (optional)
  • issues_enabled (optional)
  • merge_requests_enabled (optional)
  • builds_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • container_registry_enabled (optional)
  • shared_runners_enabled (optional)
  • public (optional)
  • visibility_level (optional)
  • import_url (optional)
  • public_builds (optional)
  • only_allow_merge_if_build_succeeds (optional)
  • only_allow_merge_if_all_discussions_are_resolved (optional)
  • lfs_enabled (optional)
  • request_access_enabled (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
all(**kwargs)

List all the projects (need admin rights).

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • **kwargs – Additional arguments to send to GitLab.
Returns:

The list of projects.

Return type:

list(gitlab.Gitlab.Project)

obj_cls

alias of Project

owned(**kwargs)

List owned projects.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • **kwargs – Additional arguments to send to GitLab.
Returns:

The list of owned projects.

Return type:

list(gitlab.Gitlab.Project)

search(query, **kwargs)

Search projects by name.

API v3 only.

Note

The search is only performed on the project name (not on the namespace or the description). To perform a smarter search, use the search argument of the list() method:

gl.projects.list(search=your_search_string)
Parameters:
  • query (str) – The query string to send to GitLab for the search.
  • all (bool) – If True, return all the items, without pagination
  • **kwargs – Additional arguments to send to GitLab.
Returns:

A list of matching projects.

Return type:

list(gitlab.Gitlab.Project)

starred(**kwargs)

List starred projects.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • **kwargs – Additional arguments to send to GitLab.
Returns:

The list of starred projects.

Return type:

list(gitlab.Gitlab.Project)

class gitlab.v3.objects.ProjectMember(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • access_level (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
optionalCreateAttrs = ['expires_at']
requiredCreateAttrs = ['access_level', 'user_id']
requiredUpdateAttrs = ['access_level']
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'username'
class gitlab.v3.objects.ProjectMemberManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectMember’> objects.

<class ‘gitlab.v3.objects.ProjectMember’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectMember’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectMember’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectMember’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • access_level (required)
  • user_id (required)
  • expires_at (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectMember

class gitlab.v3.objects.ProjectMergeRequest(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

notes

ProjectMergeRequestNoteManager - Manager for objects.

diffs

ProjectMergeRequestDiffManager - Manager for objects.

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • target_branch (optional)
  • assignee_id (optional)
  • title (optional)
  • description (optional)
  • state_event (optional)
  • labels (optional)
  • milestone_id (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
add_spent_time(**kwargs)

Set an estimated time of work for the merge request.

Raises:GitlabConnectionError – If the server cannot be reached.
cancel_merge_when_build_succeeds(**kwargs)

Cancel merge when build succeeds.

changes(**kwargs)

List the merge request changes.

Returns:

List of changes

Return type:

list (dict)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabListError – If the server fails to perform the request.
closes_issues(**kwargs)

List issues closed by the MR.

Returns:

List of closed issues

Return type:

list (ProjectIssue)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
commits(**kwargs)

List the merge request commits.

Returns:

List of commits

Return type:

list (ProjectCommit)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabListError – If the server fails to perform the request.
managers = (('notes', 'ProjectMergeRequestNoteManager', [('project_id', 'project_id'), ('merge_request_id', 'id')]), ('diffs', 'ProjectMergeRequestDiffManager', [('project_id', 'project_id'), ('merge_request_id', 'id')]))
merge(merge_commit_message=None, should_remove_source_branch=False, merge_when_build_succeeds=False, **kwargs)

Accept the merge request.

Parameters:
  • merge_commit_message (bool) – Commit message
  • should_remove_source_branch (bool) – If True, removes the source branch
  • merge_when_build_succeeds (bool) – Wait for the build to succeed, then merge
Returns:

The updated MR

Return type:

ProjectMergeRequest

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabMRForbiddenError – If the user doesn’t have permission to close thr MR
  • GitlabMRClosedError – If the MR is already closed
optionalCreateAttrs = ['assignee_id', 'description', 'target_project_id', 'labels', 'milestone_id', 'remove_source_branch']
optionalListAttrs = ['iid', 'state', 'order_by', 'sort']
optionalUpdateAttrs = ['target_branch', 'assignee_id', 'title', 'description', 'state_event', 'labels', 'milestone_id']
requiredCreateAttrs = ['source_branch', 'target_branch', 'title']
requiredUrlAttrs = ['project_id']
reset_spent_time(**kwargs)

Set an estimated time of work for the merge request.

Raises:GitlabConnectionError – If the server cannot be reached.
reset_time_estimate(**kwargs)

Resets estimated time for the merge request to 0 seconds.

Raises:GitlabConnectionError – If the server cannot be reached.
subscribe(**kwargs)

Subscribe to a MR.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabSubscribeError – If the subscription cannot be done
time_estimate(**kwargs)

Set an estimated time of work for the merge request.

Raises:GitlabConnectionError – If the server cannot be reached.
time_stats(**kwargs)

Get time stats for the merge request.

Raises:GitlabConnectionError – If the server cannot be reached.
todo(**kwargs)

Create a todo for the merge request.

Raises:GitlabConnectionError – If the server cannot be reached.
unsubscribe(**kwargs)

Unsubscribe a MR.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabUnsubscribeError – If the unsubscription cannot be done
class gitlab.v3.objects.ProjectMergeRequestDiff(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canDelete = False
canUpdate = False
requiredUrlAttrs = ['project_id', 'merge_request_id']
class gitlab.v3.objects.ProjectMergeRequestDiffManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectMergeRequestDiff’> objects.

<class ‘gitlab.v3.objects.ProjectMergeRequestDiff’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectMergeRequestDiff’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectMergeRequestDiff’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectMergeRequestDiff

class gitlab.v3.objects.ProjectMergeRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectMergeRequest’> objects.

<class ‘gitlab.v3.objects.ProjectMergeRequest’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectMergeRequest’>.

Available keys for kwargs are:

  • iid (optional)
  • state (optional)
  • order_by (optional)
  • sort (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectMergeRequest’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectMergeRequest’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • source_branch (required)
  • target_branch (required)
  • title (required)
  • assignee_id (optional)
  • description (optional)
  • target_project_id (optional)
  • labels (optional)
  • milestone_id (optional)
  • remove_source_branch (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectMergeRequest

class gitlab.v3.objects.ProjectMergeRequestNote(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • body (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
requiredCreateAttrs = ['body']
requiredUrlAttrs = ['project_id', 'merge_request_id']
class gitlab.v3.objects.ProjectMergeRequestNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectMergeRequestNote’> objects.

<class ‘gitlab.v3.objects.ProjectMergeRequestNote’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectMergeRequestNote’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectMergeRequestNote’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectMergeRequestNote’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • merge_request_id (required if not discovered on the parent objects)
  • body (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectMergeRequestNote

class gitlab.v3.objects.ProjectMilestone(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • title (optional)
  • description (optional)
  • due_date (optional)
  • start_date (optional)
  • state_event (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canDelete = False
issues(**kwargs)
merge_requests(**kwargs)

List the merge requests related to this milestone

Returns:

List of merge requests

Return type:

list (ProjectMergeRequest)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabListError – If the server fails to perform the request.
optionalCreateAttrs = ['description', 'due_date', 'start_date', 'state_event']
optionalListAttrs = ['iid', 'state']
optionalUpdateAttrs = ['title', 'description', 'due_date', 'start_date', 'state_event']
requiredCreateAttrs = ['title']
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'title'
class gitlab.v3.objects.ProjectMilestoneManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectMilestone’> objects.

<class ‘gitlab.v3.objects.ProjectMilestone’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectMilestone’>.

Available keys for kwargs are:

  • iid (optional)
  • state (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectMilestone’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectMilestone’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • title (required)
  • description (optional)
  • due_date (optional)
  • start_date (optional)
  • state_event (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectMilestone

class gitlab.v3.objects.ProjectNote(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canDelete = False
canUpdate = False
requiredCreateAttrs = ['body']
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectNote’> objects.

<class ‘gitlab.v3.objects.ProjectNote’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectNote’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectNote’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectNote’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • body (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectNote

class gitlab.v3.objects.ProjectNotificationSettings(gl, data=None, **kwargs)

Bases: gitlab.v3.objects.NotificationSettings

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • level (optional)
  • notification_email (optional)
  • new_note (optional)
  • new_issue (optional)
  • reopen_issue (optional)
  • close_issue (optional)
  • reassign_issue (optional)
  • new_merge_request (optional)
  • reopen_merge_request (optional)
  • close_merge_request (optional)
  • reassign_merge_request (optional)
  • merge_merge_request (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectNotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectNotificationSettings’> objects.

<class ‘gitlab.v3.objects.ProjectNotificationSettings’> objects can be updated.

get(**kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectNotificationSettings’>.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectNotificationSettings

class gitlab.v3.objects.ProjectPipeline(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canDelete = False
canUpdate = False
cancel(**kwargs)

Cancel builds in a pipeline.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabPipelineCancelError – If the retry cannot be done.
requiredCreateAttrs = ['ref']
requiredUrlAttrs = ['project_id']
retry(**kwargs)

Retries failed builds in a pipeline.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabPipelineRetryError – If the retry cannot be done.
class gitlab.v3.objects.ProjectPipelineManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectPipeline’> objects.

<class ‘gitlab.v3.objects.ProjectPipeline’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectPipeline’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectPipeline’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectPipeline’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • ref (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectPipeline

class gitlab.v3.objects.ProjectRunner(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['runner_id']
class gitlab.v3.objects.ProjectRunnerManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectRunner’> objects.

<class ‘gitlab.v3.objects.ProjectRunner’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectRunner’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectRunner’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectRunner’>.

data is a dict defining the object attributes. Available attributes are:

  • runner_id (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectRunner

class gitlab.v3.objects.ProjectService(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canCreate = False
canList = False
getRequiresId = False
requiredUrlAttrs = ['project_id', 'service_name']
class gitlab.v3.objects.ProjectServiceManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectService’> objects.

<class ‘gitlab.v3.objects.ProjectService’> objects can be updated.

get(**kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectService’>.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
available(**kwargs)

List the services known by python-gitlab.

Returns:The list of service code names.
Return type:list (str)
obj_cls

alias of ProjectService

class gitlab.v3.objects.ProjectSnippet(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

notes

ProjectSnippetNoteManager - Manager for objects.

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • title (optional)
  • file_name (optional)
  • code (optional)
  • visibility_level (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
content(streamed=False, action=None, chunk_size=1024, **kwargs)

Return the raw content of a snippet.

Parameters:
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The snippet content

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
managers = (('notes', 'ProjectSnippetNoteManager', [('project_id', 'project_id'), ('snippet_id', 'id')]),)
optionalCreateAttrs = ['lifetime', 'visibility_level']
optionalUpdateAttrs = ['title', 'file_name', 'code', 'visibility_level']
requiredCreateAttrs = ['title', 'file_name', 'code']
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'title'
class gitlab.v3.objects.ProjectSnippetManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectSnippet’> objects.

<class ‘gitlab.v3.objects.ProjectSnippet’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectSnippet’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectSnippet’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectSnippet’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • title (required)
  • file_name (required)
  • code (required)
  • lifetime (optional)
  • visibility_level (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectSnippet

class gitlab.v3.objects.ProjectSnippetNote(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canDelete = False
canUpdate = False
requiredCreateAttrs = ['body']
requiredUrlAttrs = ['project_id', 'snippet_id']
class gitlab.v3.objects.ProjectSnippetNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectSnippetNote’> objects.

<class ‘gitlab.v3.objects.ProjectSnippetNote’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectSnippetNote’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectSnippetNote’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectSnippetNote’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • snippet_id (required if not discovered on the parent objects)
  • body (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectSnippetNote

class gitlab.v3.objects.ProjectTag(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canGet = 'from_list'
canUpdate = False
idAttr = 'name'
optionalCreateAttrs = ['message']
requiredCreateAttrs = ['tag_name', 'ref']
requiredUrlAttrs = ['project_id']
set_release_description(description)

Set the release notes on the tag.

If the release doesn’t exist yet, it will be created. If it already exists, its description will be updated.

Parameters:

description (str) – Description of the release.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabCreateError – If the server fails to create the release.
  • GitlabUpdateError – If the server fails to update the release.
shortPrintAttr = 'name'
class gitlab.v3.objects.ProjectTagManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectTag’> objects.

<class ‘gitlab.v3.objects.ProjectTag’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectTag’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectTag’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectTag’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • tag_name (required)
  • ref (required)
  • message (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectTag

class gitlab.v3.objects.ProjectTagRelease(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • description (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canDelete = False
canList = False
requiredCreateAttrs = ['description']
requiredUrlAttrs = ['project_id', 'tag_name']
shortPrintAttr = 'description'
class gitlab.v3.objects.ProjectTrigger(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
idAttr = 'token'
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectTriggerManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectTrigger’> objects.

<class ‘gitlab.v3.objects.ProjectTrigger’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectTrigger’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectTrigger’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectTrigger’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectTrigger

class gitlab.v3.objects.ProjectVariable(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • key (required)
  • value (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
idAttr = 'key'
requiredCreateAttrs = ['key', 'value']
requiredUrlAttrs = ['project_id']
class gitlab.v3.objects.ProjectVariableManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.ProjectVariable’> objects.

<class ‘gitlab.v3.objects.ProjectVariable’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.ProjectVariable’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.ProjectVariable’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.ProjectVariable’>.

data is a dict defining the object attributes. Available attributes are:

  • project_id (required if not discovered on the parent objects)
  • key (required)
  • value (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of ProjectVariable

class gitlab.v3.objects.Runner(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • description (optional)
  • active (optional)
  • tag_list (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
canCreate = False
optionalListAttrs = ['scope']
optionalUpdateAttrs = ['description', 'active', 'tag_list']
class gitlab.v3.objects.RunnerManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Runner’> objects.

<class ‘gitlab.v3.objects.Runner’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Runner’>.

Available keys for kwargs are:

  • scope (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Runner’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
all(scope=None, **kwargs)

List all the runners.

Parameters:

scope (str) – The scope of runners to show, one of: specific, shared, active, paused, online

Returns:

a list of runners matching the scope.

Return type:

list(Runner)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabListError – If the resource cannot be found
obj_cls

alias of Runner

class gitlab.v3.objects.SidekiqManager(gl)

Bases: object

Manager for the Sidekiq methods.

This manager doesn’t actually manage objects but provides helper fonction for the sidekiq metrics API.

compound_metrics(**kwargs)

Returns all available metrics and statistics.

job_stats(**kwargs)

Returns statistics about the jobs performed.

process_metrics(**kwargs)

Returns the registred sidekiq workers.

queue_metrics(**kwargs)

Returns the registred queues information.

class gitlab.v3.objects.Snippet(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • title (optional)
  • file_name (optional)
  • content (optional)
  • visibility_level (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
optionalCreateAttrs = ['lifetime', 'visibility_level']
optionalUpdateAttrs = ['title', 'file_name', 'content', 'visibility_level']
raw(streamed=False, action=None, chunk_size=1024, **kwargs)

Return the raw content of a snippet.

Parameters:
  • streamed (bool) – If True the data will be processed by chunks of chunk_size and each chunk is passed to action for treatment.
  • action (callable) – Callable responsible of dealing with chunk of data.
  • chunk_size (int) – Size of each chunk.
Returns:

The snippet content.

Return type:

str

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
requiredCreateAttrs = ['title', 'file_name', 'content']
shortPrintAttr = 'title'
class gitlab.v3.objects.SnippetManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Snippet’> objects.

<class ‘gitlab.v3.objects.Snippet’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Snippet’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Snippet’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.Snippet’>.

data is a dict defining the object attributes. Available attributes are:

  • title (required)
  • file_name (required)
  • content (required)
  • lifetime (optional)
  • visibility_level (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Snippet

public(**kwargs)

List all the public snippets.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • **kwargs – Additional arguments to send to GitLab.
Returns:

The list of snippets.

Return type:

list(gitlab.Gitlab.Snippet)

class gitlab.v3.objects.Team(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
managers = (('members', 'TeamMemberManager', [('team_id', 'id')]), ('projects', 'TeamProjectManager', [('team_id', 'id')]))
requiredCreateAttrs = ['name', 'path']
shortPrintAttr = 'name'
class gitlab.v3.objects.TeamManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Team’> objects.

<class ‘gitlab.v3.objects.Team’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Team’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Team’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.Team’>.

data is a dict defining the object attributes. Available attributes are:

  • name (required)
  • path (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of Team

class gitlab.v3.objects.TeamMember(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['access_level']
requiredUrlAttrs = ['teamd_id']
shortPrintAttr = 'username'
class gitlab.v3.objects.TeamMemberManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.TeamMember’> objects.

<class ‘gitlab.v3.objects.TeamMember’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.TeamMember’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.TeamMember’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.TeamMember’>.

data is a dict defining the object attributes. Available attributes are:

  • teamd_id (required if not discovered on the parent objects)
  • access_level (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of TeamMember

class gitlab.v3.objects.TeamProject(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['greatest_access_level']
requiredUrlAttrs = ['team_id']
shortPrintAttr = 'name'
class gitlab.v3.objects.TeamProjectManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.TeamProject’> objects.

<class ‘gitlab.v3.objects.TeamProject’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.TeamProject’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.TeamProject’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.TeamProject’>.

data is a dict defining the object attributes. Available attributes are:

  • team_id (required if not discovered on the parent objects)
  • greatest_access_level (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of TeamProject

class gitlab.v3.objects.Todo(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canCreate = False
canGet = 'from_list'
canUpdate = False
optionalListAttrs = ['action', 'author_id', 'project_id', 'state', 'type']
class gitlab.v3.objects.TodoManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.Todo’> objects.

<class ‘gitlab.v3.objects.Todo’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.Todo’>.

Available keys for kwargs are:

  • action (optional)
  • author_id (optional)
  • project_id (optional)
  • state (optional)
  • type (optional)
  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.Todo’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete_all(**kwargs)

Mark all the todos as done.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabDeleteError – If the resource cannot be found
Returns:

The number of todos maked done.

obj_cls

alias of Todo

class gitlab.v3.objects.User(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

emails

UserEmailManager - Manager for objects.

keys

UserKeyManager - Manager for objects.

projects

UserProjectManager - Manager for objects.

save(**kwargs)

Send the modified object to the GitLab server. The following attributes are sent:

  • email (required)
  • username (required)
  • name (required)
  • password (optional)
  • skype (optional)
  • linkedin (optional)
  • twitter (optional)
  • projects_limit (optional)
  • extern_uid (optional)
  • provider (optional)
  • bio (optional)
  • admin (optional)
  • can_create_group (optional)
  • website_url (optional)
  • confirm (optional)
  • external (optional)
  • organization (optional)
  • location (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
block(**kwargs)

Blocks the user.

managers = (('emails', 'UserEmailManager', [('user_id', 'id')]), ('keys', 'UserKeyManager', [('user_id', 'id')]), ('projects', 'UserProjectManager', [('user_id', 'id')]))
optionalCreateAttrs = ['password', 'reset_password', 'skype', 'linkedin', 'twitter', 'projects_limit', 'extern_uid', 'provider', 'bio', 'admin', 'can_create_group', 'website_url', 'confirm', 'external', 'organization', 'location']
optionalUpdateAttrs = ['password', 'skype', 'linkedin', 'twitter', 'projects_limit', 'extern_uid', 'provider', 'bio', 'admin', 'can_create_group', 'website_url', 'confirm', 'external', 'organization', 'location']
requiredCreateAttrs = ['email', 'username', 'name']
requiredUpdateAttrs = ['email', 'username', 'name']
shortPrintAttr = 'username'
unblock(**kwargs)

Unblocks the user.

class gitlab.v3.objects.UserEmail(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canUpdate = False
requiredCreateAttrs = ['email']
requiredUrlAttrs = ['user_id']
shortPrintAttr = 'email'
class gitlab.v3.objects.UserEmailManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.UserEmail’> objects.

<class ‘gitlab.v3.objects.UserEmail’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.UserEmail’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.UserEmail’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.UserEmail’>.

data is a dict defining the object attributes. Available attributes are:

  • user_id (required if not discovered on the parent objects)
  • email (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of UserEmail

class gitlab.v3.objects.UserKey(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canGet = 'from_list'
canUpdate = False
requiredCreateAttrs = ['title', 'key']
requiredUrlAttrs = ['user_id']
class gitlab.v3.objects.UserKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.UserKey’> objects.

<class ‘gitlab.v3.objects.UserKey’> objects cannot be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.UserKey’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.UserKey’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.UserKey’>.

data is a dict defining the object attributes. Available attributes are:

  • user_id (required if not discovered on the parent objects)
  • title (required)
  • key (required)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of UserKey

class gitlab.v3.objects.UserManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.User’> objects.

<class ‘gitlab.v3.objects.User’> objects can be updated.

list(**kwargs)

Returns a list of objects of type <class ‘gitlab.v3.objects.User’>.

Available keys for kwargs are:

  • per_page (int): number of item per page. May be limited by the server.
  • page (int): page to retrieve
  • all (bool): iterate over all the pages and return all the entries
  • sudo (string or int): run the request as another user (requires admin permissions)
get(id, **kwargs)

Get a single object of type <class ‘gitlab.v3.objects.User’> using its id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.User’>.

data is a dict defining the object attributes. Available attributes are:

  • email (required)
  • username (required)
  • name (required)
  • password (optional)
  • reset_password (optional)
  • skype (optional)
  • linkedin (optional)
  • twitter (optional)
  • projects_limit (optional)
  • extern_uid (optional)
  • provider (optional)
  • bio (optional)
  • admin (optional)
  • can_create_group (optional)
  • website_url (optional)
  • confirm (optional)
  • external (optional)
  • organization (optional)
  • location (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
delete(id, **kwargs)

Delete the object with ID id.

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
get_by_username(username, **kwargs)

Get a user by its username.

Parameters:
  • username (str) – The name of the user.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

The matching user.

Return type:

User

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
obj_cls

alias of User

search(query, **kwargs)

Search users.

Parameters:
  • query (str) – The query string to send to GitLab for the search.
  • all (bool) – If True, return all the items, without pagination
  • **kwargs – Additional arguments to send to GitLab.
Returns:

A list of matching users.

Return type:

list(User)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabListError – If the server fails to perform the request.
class gitlab.v3.objects.UserProject(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

canDelete = False
canGet = False
canList = False
canUpdate = False
optionalCreateAttrs = ['default_branch', 'issues_enabled', 'wall_enabled', 'merge_requests_enabled', 'wiki_enabled', 'snippets_enabled', 'public', 'visibility_level', 'description', 'builds_enabled', 'public_builds', 'import_url', 'only_allow_merge_if_build_succeeds']
requiredCreateAttrs = ['name']
requiredUrlAttrs = ['user_id']
class gitlab.v3.objects.UserProjectManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for <class ‘gitlab.v3.objects.UserProject’> objects.

<class ‘gitlab.v3.objects.UserProject’> objects cannot be updated.

create(data, **kwargs)

Create an object of type <class ‘gitlab.v3.objects.UserProject’>.

data is a dict defining the object attributes. Available attributes are:

  • user_id (required if not discovered on the parent objects)
  • name (required)
  • default_branch (optional)
  • issues_enabled (optional)
  • wall_enabled (optional)
  • merge_requests_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • public (optional)
  • visibility_level (optional)
  • description (optional)
  • builds_enabled (optional)
  • public_builds (optional)
  • import_url (optional)
  • only_allow_merge_if_build_succeeds (optional)

Available keys for kwargs are:

  • sudo (string or int): run the request as another user (requires admin permissions)
obj_cls

alias of UserProject

Module contents