gitlab package

Module contents

Wrapper for the GitLab API.

class gitlab.Gitlab(url, private_token=None, email=None, password=None, ssl_verify=True, http_username=None, http_password=None, timeout=None, api_version='3')

Bases: object

Represents a GitLab server connection.

Parameters:
  • url (str) – The URL of the GitLab server.
  • private_token (str) – The user private token
  • email (str) – The user email or login.
  • password (str) – The user password (associated with email).
  • ssl_verify (bool) – Whether SSL certificates should be validated.
  • timeout (float) – Timeout to use for requests to the GitLab server.
  • http_username (str) – Username for HTTP authentication
  • http_password (str) – Password for HTTP authentication
  • api_version (str) – Gitlab API version to use (3 or 4)
broadcastmessages

BroadcastMessageManager manager for BroadcastMessage objects.

deploykeys

DeployKeyManager manager for DeployKey objects.

gitignores

GitignoreManager manager for Gitignore objects.

gitlabciymls

GitlabciymlManager manager for Gitlabciyml objects.

group_accessrequests

GroupAccessRequestManager manager for GroupAccessRequest objects.

group_issues

GroupIssueManager manager for GroupIssue objects.

group_members

GroupMemberManager manager for GroupMember objects.

group_notificationsettings

GroupNotificationSettingsManager manager for GroupNotificationSettings objects.

group_project_accessrequests

ProjectAccessRequestManager manager for ProjectAccessRequest objects.

group_project_board_lists

ProjectBoardListManager manager for ProjectBoardList objects.

group_project_boards

ProjectBoardManager manager for ProjectBoard objects.

group_project_branches

ProjectBranchManager manager for ProjectBranch objects.

group_project_builds

ProjectBuildManager manager for ProjectBuild objects.

group_project_commits

ProjectCommitManager manager for ProjectCommit objects.

group_project_deployments

ProjectDeploymentManager manager for ProjectDeployment objects.

group_project_environments

ProjectEnvironmentManager manager for ProjectEnvironment objects.

group_project_events

ProjectEventManager manager for ProjectEvent objects.

group_project_files

ProjectFileManager manager for ProjectFile objects.

group_project_forks

ProjectForkManager manager for ProjectFork objects.

group_project_hooks

ProjectHookManager manager for ProjectHook objects.

group_project_issues

ProjectIssueManager manager for ProjectIssue objects.

group_project_keys

ProjectKeyManager manager for ProjectKey objects.

group_project_labels

ProjectLabelManager manager for ProjectLabel objects.

group_project_members

ProjectMemberManager manager for ProjectMember objects.

group_project_mergerequests

ProjectMergeRequestManager manager for ProjectMergeRequest objects.

group_project_milestones

ProjectMilestoneManager manager for ProjectMilestone objects.

group_project_notes

ProjectNoteManager manager for ProjectNote objects.

group_project_notificationsettings

ProjectNotificationSettingsManager manager for ProjectNotificationSettings objects.

group_project_pipelines

ProjectPipelineManager manager for ProjectPipeline objects.

group_project_runners

ProjectRunnerManager manager for ProjectRunner objects.

group_project_services

ProjectServiceManager manager for ProjectService objects.

group_project_snippets

ProjectSnippetManager manager for ProjectSnippet objects.

group_project_tags

ProjectTagManager manager for ProjectTag objects.

group_project_triggers

ProjectTriggerManager manager for ProjectTrigger objects.

group_project_variables

ProjectVariableManager manager for ProjectVariable objects.

group_projects

GroupProjectManager manager for GroupProject objects.

groups

GroupManager manager for Group objects.

hooks

HookManager manager for Hook objects.

issues

IssueManager manager for Issue objects.

keys

KeyManager manager for Key objects.

licenses

LicenseManager manager for License objects.

namespaces

NamespaceManager manager for Namespace objects.

notificationsettings

NotificationSettingsManager manager for NotificationSettings objects.

project_accessrequests

ProjectAccessRequestManager manager for ProjectAccessRequest objects.

project_board_lists

ProjectBoardListManager manager for ProjectBoardList objects.

project_boards

ProjectBoardManager manager for ProjectBoard objects.

project_branches

ProjectBranchManager manager for ProjectBranch objects.

project_builds

ProjectBuildManager manager for ProjectBuild objects.

project_commit_comments

ProjectCommitCommentManager manager for ProjectCommitComment objects.

project_commit_statuses

ProjectCommitStatusManager manager for ProjectCommitStatus objects.

project_commits

ProjectCommitManager manager for ProjectCommit objects.

project_deployments

ProjectDeploymentManager manager for ProjectDeployment objects.

project_environments

ProjectEnvironmentManager manager for ProjectEnvironment objects.

project_events

ProjectEventManager manager for ProjectEvent objects.

project_files

ProjectFileManager manager for ProjectFile objects.

project_forks

ProjectForkManager manager for ProjectFork objects.

project_hooks

ProjectHookManager manager for ProjectHook objects.

project_issue_notes

ProjectIssueNoteManager manager for ProjectIssueNote objects.

project_issues

ProjectIssueManager manager for ProjectIssue objects.

project_keys

ProjectKeyManager manager for ProjectKey objects.

project_labels

ProjectLabelManager manager for ProjectLabel objects.

project_members

ProjectMemberManager manager for ProjectMember objects.

project_mergerequest_diffs

ProjectMergeRequestDiffManager manager for ProjectMergeRequestDiff objects.

project_mergerequest_notes

ProjectMergeRequestNoteManager manager for ProjectMergeRequestNote objects.

project_mergerequests

ProjectMergeRequestManager manager for ProjectMergeRequest objects.

project_milestones

ProjectMilestoneManager manager for ProjectMilestone objects.

project_notes

ProjectNoteManager manager for ProjectNote objects.

project_notificationsettings

ProjectNotificationSettingsManager manager for ProjectNotificationSettings objects.

project_pipelines

ProjectPipelineManager manager for ProjectPipeline objects.

project_runners

ProjectRunnerManager manager for ProjectRunner objects.

project_services

ProjectServiceManager manager for ProjectService objects.

project_snippet_notes

ProjectSnippetNoteManager manager for ProjectSnippetNote objects.

project_snippets

ProjectSnippetManager manager for ProjectSnippet objects.

project_tags

ProjectTagManager manager for ProjectTag objects.

project_triggers

ProjectTriggerManager manager for ProjectTrigger objects.

project_variables

ProjectVariableManager manager for ProjectVariable objects.

projects

ProjectManager manager for Project objects.

runners

RunnerManager manager for Runner objects.

settings

ApplicationSettingsManager manager for ApplicationSettings objects.

snippets

SnippetManager manager for Snippet objects.

team_members

TeamMemberManager manager for TeamMember objects.

team_projects

TeamProjectManager manager for TeamProject objects.

teams

TeamManager manager for Team objects.

todos

TodoManager manager for Todo objects.

user_emails

UserEmailManager manager for UserEmail objects.

user_keys

UserKeyManager manager for UserKey objects.

user_projects

UserProjectManager manager for UserProject objects.

users

UserManager manager for User objects.

api_version
auth()

Performs an authentication.

Uses either the private token, or the email/password pair.

The user attribute will hold a gitlab.objects.CurrentUser object on success.

create(obj, **kwargs)

Create an object on the GitLab server.

The object class and attributes define the request to be made on the GitLab server.

Parameters:
  • obj (object) – The object to create.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

A json representation of the object as returned by the GitLab

server

Return type:

str

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

Performs an authentication using email/password.

delete(obj, id=None, **kwargs)

Delete an object on the GitLab server.

Parameters:
  • obj (object or id) – The object, or the class of the object to delete. If it is the class, the id of the object must be specified as the id arguments.
  • id – ID of the object to remove. Required if obj is a class.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

True if the operation succeeds.

Return type:

bool

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabDeleteError – If the server fails to perform the request.
email = None

The user email

enable_debug()
static from_config(gitlab_id=None, config_files=None)

Create a Gitlab connection from configuration files.

Parameters:
  • gitlab_id (str) – ID of the configuration section.
  • list[str] (config_files) – List of paths to configuration files.
Returns:

A Gitlab connection.

Return type:

(gitlab.Gitlab)

Raises:

gitlab.config.GitlabDataError – If the configuration is not correct.

get(obj_class, id=None, **kwargs)

Request a GitLab resources.

Parameters:
  • obj_class (object) – The class of resource to request.
  • id – The object ID.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

An object of class obj_class.

Return type:

obj_class

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
headers = None

Headers that will be used in request to GitLab

list(obj_class, **kwargs)

Request the listing of GitLab resources.

Parameters:
  • obj_class (object) – The class of resource to request.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

A list of objects of class obj_class.

Return type:

list(obj_class)

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabListError – If the server fails to perform the request.
password = None

The user password (associated with email)

session = None

Create a session object for requests

set_credentials(email, password)

Sets the email/login and password for authentication.

Parameters:
  • email (str) – The user email or login.
  • password (str) – The user password.
set_token(token)

Sets the private token for authentication.

Parameters:token (str) – The private token.
set_url(url)

Updates the GitLab URL.

Parameters:url (str) – Base URL of the GitLab server.
ssl_verify = None

Whether SSL certificates should be validated

timeout = None

Timeout to use for requests to gitlab server

token_auth()

Performs an authentication using the private token.

update(obj, **kwargs)

Update an object on the GitLab server.

The object class and attributes define the request to be made on the GitLab server.

Parameters:
  • obj (object) – The object to create.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

A json representation of the object as returned by the GitLab

server

Return type:

str

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

Returns the version and revision of the gitlab server.

Note that self.version and self.revision will be set on the gitlab object.

Returns:
The server version and server revision, or
(‘unknown’, ‘unknwown’) if the server doesn’t support this API call (gitlab < 8.13.0)
Return type:tuple (str, str)

gitlab.base

class gitlab.base.BaseManager(gl, parent=None, args=[])

Bases: object

Base manager class for API operations.

Managers provide method to manage GitLab API objects, such as retrieval, listing, creation.

Inherited class must define the obj_cls attribute.

obj_cls

class – class of objects wrapped by this manager.

create(data, **kwargs)

Create a new object of class obj_cls.

Parameters:
  • data (dict) – The parameters to send to the GitLab server to create the object. Required and optional arguments are defined in the requiredCreateAttrs and optionalCreateAttrs of the obj_cls class.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

A newly create obj_cls object.

Return type:

object

Raises:
  • NotImplementedError – If objects cannot be created.
  • GitlabCreateError – If the server fails to perform the request.
delete(id, **kwargs)

Delete a GitLab object.

Parameters:

id – ID of the object to delete.

Raises:
  • NotImplementedError – If objects cannot be deleted.
  • GitlabDeleteError – If the server fails to perform the request.
get(id=None, **kwargs)

Get a GitLab object.

Parameters:
  • id – ID of the object to retrieve.
  • **kwargs – Additional arguments to send to GitLab.
Returns:

An object of class obj_cls.

Return type:

object

Raises:
  • NotImplementedError – If objects cannot be retrieved.
  • GitlabGetError – If the server fails to perform the request.
list(**kwargs)

Get a list of GitLab objects.

Parameters:

**kwargs – Additional arguments to send to GitLab.

Returns:

A list of obj_cls objects.

Return type:

list[object]

Raises:
  • NotImplementedError – If objects cannot be listed.
  • GitlabListError – If the server fails to perform the request.
obj_cls = None
class gitlab.base.GitlabObject(gl, data=None, **kwargs)

Bases: object

Base class for all classes that interface with GitLab.

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)
as_dict()

Dump the object as a dict.

canCreate = True

Tells if GitLab-api allows creation of new objects.

canDelete = True

Tells if GitLab-api allows deleting object.

canGet = True

Tells if GitLab-api allows retrieving single objects.

canList = True

Tells if GitLab-api allows listing of objects.

canUpdate = True

Tells if GitLab-api allows updating object.

classmethod create(gl, data, **kwargs)

Create an object.

Parameters:
  • gl (gitlab.Gitlab) – Gitlab object referencing the GitLab server.
  • data (dict) – The data used to define the object.
Returns:

The new object.

Return type:

object

Raises:
  • NotImplementedError – If objects can’t be created.
  • GitlabCreateError – If the server cannot perform the request.
delete(**kwargs)
display(pretty)
classmethod get(gl, id, **kwargs)

Retrieve a single object.

Parameters:
  • gl (gitlab.Gitlab) – Gitlab object referencing the GitLab server.
  • id (int or str) – ID of the object to retrieve.
Returns:

The found GitLab object.

Return type:

object

Raises:
  • NotImplementedError – If objects can’t be retrieved.
  • GitlabGetError – If the server cannot perform the request.
getRequiresId = True

Whether the object ID is required in the GET url.

gitlab = None

(gitlab.Gitlab) – Gitlab connection.

idAttr = 'id'

Name of the identifier of an object.

json()

Dump the object as json.

Returns:The json string.
Return type:str
classmethod list(gl, **kwargs)

Retrieve a list of objects from GitLab.

Parameters:
  • gl (gitlab.Gitlab) – Gitlab object referencing the GitLab server.
  • per_page (int) – Maximum number of items to return.
  • page (int) – ID of the page to return when using pagination.
Returns:

A list of objects.

Return type:

list[object]

Raises:
  • NotImplementedError – If objects can’t be listed.
  • GitlabListError – If the server cannot perform the request.
managers = []

List of managers to create.

optionalCreateAttrs = []

Attributes that are optional when creating a new object.

optionalGetAttrs = []

Attributes that are optional when retrieving single object.

optionalListAttrs = []

Attributes that are optional when retrieving list of objects.

optionalUpdateAttrs = []

Attributes that are optional when updating an object.

pretty_print(depth=0)

Print the object on the standard output (verbose).

Parameters:depth (int) – Used internaly for recursive call.
requiredCreateAttrs = []

Attributes that are required when creating a new object.

requiredDeleteAttrs = []

Attributes that are required when deleting object.

requiredGetAttrs = []

Attributes that are required when retrieving single object.

requiredListAttrs = []

Attributes that are required when retrieving list of objects.

requiredUpdateAttrs = []

Attributes that are required when updating an object.

requiredUrlAttrs = []

Attributes that are required for constructing url.

save(**kwargs)
shortPrintAttr = None

Attribute to use as ID when displaying the object.

short_print(depth=0)

Print the object on the standard output (verbose).

Parameters:depth (int) – Used internaly for recursive call.
class gitlab.base.jsonEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)

Bases: json.encoder.JSONEncoder

default(obj)

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)
class gitlab.v3.objects.ApplicationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ApplicationSettings objects.

ApplicationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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)
class gitlab.v3.objects.BroadcastMessageManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for BroadcastMessage objects.

BroadcastMessage objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

managers = (('emails', 'CurrentUserEmailManager', [('user_id', 'id')]), ('keys', 'CurrentUserKeyManager', [('user_id', 'id')]))
class gitlab.v3.objects.CurrentUserEmail(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

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

Bases: gitlab.base.BaseManager

Manager for CurrentUserEmail objects.

CurrentUserEmail objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for CurrentUserKey objects.

CurrentUserKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for DeployKey objects.

DeployKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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

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

Bases: gitlab.base.BaseManager

Manager for Gitignore objects.

Gitignore objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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

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

Bases: gitlab.base.BaseManager

Manager for Gitlabciyml objects.

Gitlabciyml objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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

:class:GroupAccessRequestManager - Manager for :class: objects.

members

:class:GroupMemberManager - Manager for :class: objects.

notificationsettings

:class:GroupNotificationSettingsManager - Manager for :class: objects.

projects

:class:GroupProjectManager - Manager for :class: objects.

issues

:class:GroupIssueManager - Manager for :class: 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')]))
transfer_project(id, **kwargs)

Transfers a project to this new groups.

Attrs:
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.

Attrs:
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.
class gitlab.v3.objects.GroupAccessRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for GroupAccessRequest objects.

GroupAccessRequest objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for GroupIssue objects.

GroupIssue objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 Group objects.

Group objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.GroupMemberManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for GroupMember objects.

GroupMember objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.GroupNotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for GroupNotificationSettings objects.

GroupNotificationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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

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

Bases: gitlab.v3.objects.ProjectManager

Manager for GroupProject objects.

GroupProject objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.HookManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Hook objects.

Hook objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.IssueManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Issue objects.

Issue objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.KeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Key objects.

Key objects cannot be updated.

list(**kwargs)

Returns a list of objects of type Key.

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 Key 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 Key

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

Bases: gitlab.base.GitlabObject

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

Bases: gitlab.base.BaseManager

Manager for License objects.

License objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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

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

Bases: gitlab.base.BaseManager

Manager for Namespace objects.

Namespace objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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)
class gitlab.v3.objects.NotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for NotificationSettings objects.

NotificationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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

:class:ProjectAccessRequestManager - Manager for :class: objects.

boards

:class:ProjectBoardManager - Manager for :class: objects.

board_lists

:class:ProjectBoardListManager - Manager for :class: objects.

branches

:class:ProjectBranchManager - Manager for :class: objects.

builds

:class:ProjectBuildManager - Manager for :class: objects.

commits

:class:ProjectCommitManager - Manager for :class: objects.

deployments

:class:ProjectDeploymentManager - Manager for :class: objects.

environments

:class:ProjectEnvironmentManager - Manager for :class: objects.

events

:class:ProjectEventManager - Manager for :class: objects.

files

:class:ProjectFileManager - Manager for :class: objects.

forks

:class:ProjectForkManager - Manager for :class: objects.

hooks

:class:ProjectHookManager - Manager for :class: objects.

keys

:class:ProjectKeyManager - Manager for :class: objects.

issues

:class:ProjectIssueManager - Manager for :class: objects.

labels

:class:ProjectLabelManager - Manager for :class: objects.

members

:class:ProjectMemberManager - Manager for :class: objects.

mergerequests

:class:ProjectMergeRequestManager - Manager for :class: objects.

milestones

:class:ProjectMilestoneManager - Manager for :class: objects.

notes

:class:ProjectNoteManager - Manager for :class: objects.

notificationsettings

:class:ProjectNotificationSettingsManager - Manager for :class: objects.

pipelines

:class:ProjectPipelineManager - Manager for :class: objects.

runners

:class:ProjectRunnerManager - Manager for :class: objects.

services

:class:ProjectServiceManager - Manager for :class: objects.

snippets

:class:ProjectSnippetManager - Manager for :class: objects.

tags

:class:ProjectTagManager - Manager for :class: objects.

triggers

:class:ProjectTriggerManager - Manager for :class: objects.

variables

:class:ProjectVariableManager - Manager for :class: 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.
archive_(**kwargs)
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')]))
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.
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.
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.
unarchive_(**kwargs)
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.
class gitlab.v3.objects.ProjectAccessRequest(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

approve(access_level=30, **kwargs)

Approve an access request.

Attrs:
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.
class gitlab.v3.objects.ProjectAccessRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectAccessRequest objects.

ProjectAccessRequest objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

managers = (('lists', 'ProjectBoardListManager', [('project_id', 'project_id'), ('board_id', '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)
class gitlab.v3.objects.ProjectBoardListManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectBoardList objects.

ProjectBoardList objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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 ProjectBoard objects.

ProjectBoard objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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

protect(protect=True, **kwargs)

Protects the branch.

unprotect(**kwargs)

Unprotects the branch.

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

Bases: gitlab.base.BaseManager

Manager for ProjectBranch objects.

ProjectBranch objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.
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.

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 ProjectBuild objects.

ProjectBuild objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.
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')]))
class gitlab.v3.objects.ProjectCommitComment(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

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

Bases: gitlab.base.BaseManager

Manager for ProjectCommitComment objects.

ProjectCommitComment objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 ProjectCommit objects.

ProjectCommit objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectCommitStatus objects.

ProjectCommitStatus objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectDeployment objects.

ProjectDeployment objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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)
class gitlab.v3.objects.ProjectEnvironmentManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectEnvironment objects.

ProjectEnvironment objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectEvent objects.

ProjectEvent objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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)
decode()

Returns the decoded content of the file.

Returns:the decoded content.
Return type:(str)
class gitlab.v3.objects.ProjectFileManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectFile objects.

ProjectFile objects can be updated.

get(**kwargs)

Get a single object of type 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectFork objects.

ProjectFork objects cannot be updated.

create(data, **kwargs)

Create an object of type 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)
class gitlab.v3.objects.ProjectHookManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectHook objects.

ProjectHook objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

:class:ProjectIssueNoteManager - Manager for :class: 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.
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.
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.
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 ProjectIssue objects.

ProjectIssue objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.ProjectIssueNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectIssueNote objects.

ProjectIssueNote objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectKey objects.

ProjectKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
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 ProjectLabel objects.

ProjectLabel objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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 Project objects.

Project objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.ProjectMemberManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMember objects.

ProjectMember objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

:class:ProjectMergeRequestNoteManager - Manager for :class: objects.

diffs

:class:ProjectMergeRequestDiffManager - Manager for :class: 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, merged_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
  • merged_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
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

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

Bases: gitlab.base.BaseManager

Manager for ProjectMergeRequestDiff objects.

ProjectMergeRequestDiff objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 ProjectMergeRequest objects.

ProjectMergeRequest objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.ProjectMergeRequestNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMergeRequestNote objects.

ProjectMergeRequestNote objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
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.
class gitlab.v3.objects.ProjectMilestoneManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMilestone objects.

ProjectMilestone objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectNote objects.

ProjectNote objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.ProjectNotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectNotificationSettings objects.

ProjectNotificationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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

cancel(**kwargs)

Cancel builds in a pipeline.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabPipelineCancelError – If the retry cannot be done.
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 ProjectPipeline objects.

ProjectPipeline objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectRunner objects.

ProjectRunner objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.ProjectServiceManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectService objects.

ProjectService objects can be updated.

get(**kwargs)

Get a single object of type 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

:class:ProjectSnippetNoteManager - Manager for :class: 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')]),)
class gitlab.v3.objects.ProjectSnippetManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectSnippet objects.

ProjectSnippet objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for ProjectSnippetNote objects.

ProjectSnippetNote objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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.
class gitlab.v3.objects.ProjectTagManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectTag objects.

ProjectTag objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.ProjectTrigger(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

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

Bases: gitlab.base.BaseManager

Manager for ProjectTrigger objects.

ProjectTrigger objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.ProjectVariableManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectVariable objects.

ProjectVariable objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
class gitlab.v3.objects.RunnerManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Runner objects.

Runner objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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.SnippetManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Snippet objects.

Snippet objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for Team objects.

Team objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for TeamMember objects.

TeamMember objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for TeamProject objects.

TeamProject objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for Todo objects.

Todo objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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

:class:UserEmailManager - Manager for :class: objects.

keys

:class:UserKeyManager - Manager for :class: objects.

projects

:class:UserProjectManager - Manager for :class: 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')]))
unblock(**kwargs)

Unblocks the user.

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

Bases: gitlab.base.GitlabObject

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

Bases: gitlab.base.BaseManager

Manager for UserEmail objects.

UserEmail objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for UserKey objects.

UserKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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 User objects.

User objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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

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

Bases: gitlab.base.BaseManager

Manager for UserProject objects.

UserProject objects cannot be updated.

create(data, **kwargs)

Create an object of type 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

gitlab.v4.objects module

class gitlab.v4.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)
class gitlab.v4.objects.ApplicationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ApplicationSettings objects.

ApplicationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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.v4.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)
class gitlab.v4.objects.BroadcastMessageManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for BroadcastMessage objects.

BroadcastMessage objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.CurrentUser(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

managers = (('emails', 'CurrentUserEmailManager', [('user_id', 'id')]), ('keys', 'CurrentUserKeyManager', [('user_id', 'id')]))
class gitlab.v4.objects.CurrentUserEmail(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.CurrentUserEmailManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for CurrentUserEmail objects.

CurrentUserEmail objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.CurrentUserKey(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.CurrentUserKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for CurrentUserKey objects.

CurrentUserKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.DeployKey(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.DeployKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for DeployKey objects.

DeployKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.Dockerfile(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.DockerfileManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Dockerfile objects.

Dockerfile objects cannot be updated.

list(**kwargs)

Returns a list of objects of type Dockerfile.

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 Dockerfile 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 Dockerfile

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

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.GitignoreManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Gitignore objects.

Gitignore objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.Gitlabciyml(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.GitlabciymlManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Gitlabciyml objects.

Gitlabciyml objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.Group(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

accessrequests

:class:GroupAccessRequestManager - Manager for :class: objects.

members

:class:GroupMemberManager - Manager for :class: objects.

notificationsettings

:class:GroupNotificationSettingsManager - Manager for :class: objects.

projects

:class:GroupProjectManager - Manager for :class: objects.

issues

:class:GroupIssueManager - Manager for :class: objects.

save(**kwargs)

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

  • name (optional)
  • path (optional)
  • description (optional)
  • visibility (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)
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')]))
transfer_project(id, **kwargs)

Transfers a project to this new groups.

Attrs:
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.v4.objects.GroupAccessRequest(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

approve(access_level=30, **kwargs)

Approve an access request.

Attrs:
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.
class gitlab.v4.objects.GroupAccessRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for GroupAccessRequest objects.

GroupAccessRequest objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.GroupIssue(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.GroupIssueManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for GroupIssue objects.

GroupIssue objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.GroupManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Group objects.

Group objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 Group.

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

  • name (required)
  • path (required)
  • description (optional)
  • visibility (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

class gitlab.v4.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)
class gitlab.v4.objects.GroupMemberManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for GroupMember objects.

GroupMember objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.GroupNotificationSettings(gl, data=None, **kwargs)

Bases: gitlab.v4.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)
class gitlab.v4.objects.GroupNotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for GroupNotificationSettings objects.

GroupNotificationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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.v4.objects.GroupProject(*args, **kwargs)

Bases: gitlab.v4.objects.Project

class gitlab.v4.objects.GroupProjectManager(gl, parent=None, args=[])

Bases: gitlab.v4.objects.ProjectManager

Manager for GroupProject objects.

GroupProject objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.HookManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Hook objects.

Hook objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.IssueManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Issue objects.

Issue objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.License(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.LicenseManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for License objects.

License objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.Namespace(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.NamespaceManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Namespace objects.

Namespace objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.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)
class gitlab.v4.objects.NotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for NotificationSettings objects.

NotificationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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.v4.objects.Project(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

accessrequests

:class:ProjectAccessRequestManager - Manager for :class: objects.

boards

:class:ProjectBoardManager - Manager for :class: objects.

board_lists

:class:ProjectBoardListManager - Manager for :class: objects.

branches

:class:ProjectBranchManager - Manager for :class: objects.

jobs

:class:ProjectJobManager - Manager for :class: objects.

commits

:class:ProjectCommitManager - Manager for :class: objects.

deployments

:class:ProjectDeploymentManager - Manager for :class: objects.

environments

:class:ProjectEnvironmentManager - Manager for :class: objects.

events

:class:ProjectEventManager - Manager for :class: objects.

files

:class:ProjectFileManager - Manager for :class: objects.

forks

:class:ProjectForkManager - Manager for :class: objects.

hooks

:class:ProjectHookManager - Manager for :class: objects.

keys

:class:ProjectKeyManager - Manager for :class: objects.

issues

:class:ProjectIssueManager - Manager for :class: objects.

labels

:class:ProjectLabelManager - Manager for :class: objects.

members

:class:ProjectMemberManager - Manager for :class: objects.

mergerequests

:class:ProjectMergeRequestManager - Manager for :class: objects.

milestones

:class:ProjectMilestoneManager - Manager for :class: objects.

notes

:class:ProjectNoteManager - Manager for :class: objects.

notificationsettings

:class:ProjectNotificationSettingsManager - Manager for :class: objects.

pipelines

:class:ProjectPipelineManager - Manager for :class: objects.

runners

:class:ProjectRunnerManager - Manager for :class: objects.

services

:class:ProjectServiceManager - Manager for :class: objects.

snippets

:class:ProjectSnippetManager - Manager for :class: objects.

tags

:class:ProjectTagManager - Manager for :class: objects.

triggers

:class:ProjectTriggerManager - Manager for :class: objects.

variables

:class:ProjectVariableManager - Manager for :class: 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)
  • visibility (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)
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')]), ('jobs', 'ProjectJobManager', [('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')]))
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_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='', **kwargs)

Return a list of files in the repository.

Parameters:
  • path (str) – Path of the top folder (/ by default)
  • ref (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.
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.
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_pipeline(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.
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.
class gitlab.v4.objects.ProjectAccessRequest(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

approve(access_level=30, **kwargs)

Approve an access request.

Attrs:
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.
class gitlab.v4.objects.ProjectAccessRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectAccessRequest objects.

ProjectAccessRequest objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectBoard(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

managers = (('lists', 'ProjectBoardListManager', [('project_id', 'project_id'), ('board_id', 'id')]),)
class gitlab.v4.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)
class gitlab.v4.objects.ProjectBoardListManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectBoardList objects.

ProjectBoardList objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectBoardManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectBoard objects.

ProjectBoard objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.ProjectBranch(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

protect(protect=True, **kwargs)

Protects the branch.

unprotect(**kwargs)

Unprotects the branch.

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

Bases: gitlab.base.BaseManager

Manager for ProjectBranch objects.

ProjectBranch objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 ProjectBranch.

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

  • project_id (required if not discovered on the parent objects)
  • branch (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.v4.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.
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')]))
class gitlab.v4.objects.ProjectCommitComment(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectCommitCommentManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectCommitComment objects.

ProjectCommitComment objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.ProjectCommitManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectCommit objects.

ProjectCommit objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 ProjectCommit.

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

  • project_id (required if not discovered on the parent objects)
  • branch (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.v4.objects.ProjectCommitStatus(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectCommitStatusManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectCommitStatus objects.

ProjectCommitStatus objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectDeployment(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectDeploymentManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectDeployment objects.

ProjectDeployment objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.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)
class gitlab.v4.objects.ProjectEnvironmentManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectEnvironment objects.

ProjectEnvironment objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectEvent(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectEventManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectEvent objects.

ProjectEvent objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.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 (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)
decode()

Returns the decoded content of the file.

Returns:the decoded content.
Return type:(str)
class gitlab.v4.objects.ProjectFileManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectFile objects.

ProjectFile objects can be updated.

get(id, **kwargs)

Get a single object of type ProjectFile using its id.

Available keys for kwargs are:

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

Create an object of type 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 (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

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

Return the content of a file for a commit.

Parameters:
  • ref (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.
class gitlab.v4.objects.ProjectFork(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectForkManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectFork objects.

ProjectFork objects cannot be updated.

create(data, **kwargs)

Create an object of type 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.v4.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)
  • job_events (optional)
  • wiki_page_events (optional)

Available keys for kwargs are:

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

Bases: gitlab.base.BaseManager

Manager for ProjectHook objects.

ProjectHook objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
  • job_events (optional)
  • wiki_page_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.v4.objects.ProjectIssue(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

notes

:class:ProjectIssueNoteManager - Manager for :class: 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(duration, **kwargs)

Set an estimated time of work for the issue.

Parameters:duration (str) – duration in human format (e.g. 3h30)
Raises:GitlabConnectionError – If the server cannot be reached.
managers = (('notes', 'ProjectIssueNoteManager', [('project_id', 'project_id'), ('issue_iid', 'iid')]),)
move(to_project_id, **kwargs)

Move the issue to another project.

Raises:GitlabConnectionError – If the server cannot be reached.
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.
subscribe(**kwargs)

Subscribe to an issue.

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

Set an estimated time of work for the issue.

Parameters:duration (str) – duration in human format (e.g. 3h30)
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.v4.objects.ProjectIssueManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectIssue objects.

ProjectIssue objects can be updated.

list(**kwargs)

Returns a list of objects of type ProjectIssue.

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 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 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.v4.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)
class gitlab.v4.objects.ProjectIssueNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectIssueNote objects.

ProjectIssueNote objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 ProjectIssueNote.

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

  • project_id (required if not discovered on the parent objects)
  • issue_iid (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.v4.objects.ProjectJob(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

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

Get the job 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.
cancel(**kwargs)

Cancel the job.

erase(**kwargs)

Erase the job (remove job 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 job explicitly.

retry(**kwargs)

Retry the job.

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

Get the job 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.v4.objects.ProjectJobManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectJob objects.

ProjectJob objects cannot be updated.

list(**kwargs)

Returns a list of objects of type ProjectJob.

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 ProjectJob 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 ProjectJob

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

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectKey objects.

ProjectKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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)
enable(key_id)

Enable a deploy key for a project.

obj_cls

alias of ProjectKey

class gitlab.v4.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)
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.v4.objects.ProjectLabelManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectLabel objects.

ProjectLabel objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Project objects.

Project objects can be updated.

list(**kwargs)

Returns a list of objects of type Project.

Available keys for kwargs are:

  • search (optional)
  • owned (optional)
  • starred (optional)
  • archived (optional)
  • visibility (optional)
  • order_by (optional)
  • sort (optional)
  • simple (optional)
  • membership (optional)
  • statistics (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 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 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)
  • visibility (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)
obj_cls

alias of Project

class gitlab.v4.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)
class gitlab.v4.objects.ProjectMemberManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMember objects.

ProjectMember objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectMergeRequest(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

notes

:class:ProjectMergeRequestNoteManager - Manager for :class: objects.

diffs

:class:ProjectMergeRequestDiffManager - Manager for :class: 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(duration, **kwargs)

Set an estimated time of work for the merge request.

Parameters:duration (str) – duration in human format (e.g. 3h30)
Raises:GitlabConnectionError – If the server cannot be reached.
cancel_merge_when_pipeline_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_iid', 'iid')]), ('diffs', 'ProjectMergeRequestDiffManager', [('project_id', 'project_id'), ('merge_request_iid', 'iid')]))
merge(merge_commit_message=None, should_remove_source_branch=False, merged_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
  • merged_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
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(duration, **kwargs)

Set an estimated time of work for the merge request.

Parameters:duration (str) – duration in human format (e.g. 3h30)
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.v4.objects.ProjectMergeRequestDiff(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectMergeRequestDiffManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMergeRequestDiff objects.

ProjectMergeRequestDiff objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.ProjectMergeRequestManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMergeRequest objects.

ProjectMergeRequest objects can be updated.

list(**kwargs)

Returns a list of objects of type ProjectMergeRequest.

Available keys for kwargs are:

  • iids (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 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 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.v4.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)
class gitlab.v4.objects.ProjectMergeRequestNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMergeRequestNote objects.

ProjectMergeRequestNote objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 ProjectMergeRequestNote.

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

  • project_id (required if not discovered on the parent objects)
  • merge_request_iid (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.v4.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)
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.
class gitlab.v4.objects.ProjectMilestoneManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectMilestone objects.

ProjectMilestone objects can be updated.

list(**kwargs)

Returns a list of objects of type ProjectMilestone.

Available keys for kwargs are:

  • iids (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 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 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.v4.objects.ProjectNote(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectNote objects.

ProjectNote objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectNotificationSettings(gl, data=None, **kwargs)

Bases: gitlab.v4.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)
class gitlab.v4.objects.ProjectNotificationSettingsManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectNotificationSettings objects.

ProjectNotificationSettings objects can be updated.

get(**kwargs)

Get a single object of type 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.v4.objects.ProjectPipeline(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

cancel(**kwargs)

Cancel builds in a pipeline.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabPipelineCancelError – If the retry cannot be done.
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.v4.objects.ProjectPipelineManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectPipeline objects.

ProjectPipeline objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectRunner(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectRunnerManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectRunner objects.

ProjectRunner objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.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)
class gitlab.v4.objects.ProjectServiceManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectService objects.

ProjectService objects can be updated.

get(**kwargs)

Get a single object of type 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.v4.objects.ProjectSnippet(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

notes

:class:ProjectSnippetNoteManager - Manager for :class: objects.

save(**kwargs)

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

  • title (optional)
  • file_name (optional)
  • code (optional)
  • visibility (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')]),)
class gitlab.v4.objects.ProjectSnippetManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectSnippet objects.

ProjectSnippet objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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 (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.v4.objects.ProjectSnippetNote(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.ProjectSnippetNoteManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectSnippetNote objects.

ProjectSnippetNote objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.ProjectTag(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

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.
class gitlab.v4.objects.ProjectTagManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectTag objects.

ProjectTag objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.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)
class gitlab.v4.objects.ProjectTrigger(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)

Available keys for kwargs are:

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

Update the owner of a trigger.

Raises:
  • GitlabConnectionError – If the server cannot be reached.
  • GitlabGetError – If the server fails to perform the request.
class gitlab.v4.objects.ProjectTriggerManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectTrigger objects.

ProjectTrigger objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 ProjectTrigger.

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

  • project_id (required if not discovered on the parent objects)
  • description (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 ProjectTrigger

class gitlab.v4.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)
class gitlab.v4.objects.ProjectVariableManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for ProjectVariable objects.

ProjectVariable objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.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)
class gitlab.v4.objects.RunnerManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Runner objects.

Runner objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.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.v4.objects.SnippetManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Snippet objects.

Snippet objects can be updated.

list(**kwargs)

Returns a list of objects of type 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 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 Snippet.

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

  • title (required)
  • file_name (required)
  • content (required)
  • lifetime (optional)
  • visibility (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.v4.objects.Todo(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.TodoManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for Todo objects.

Todo objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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.v4.objects.User(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

emails

:class:UserEmailManager - Manager for :class: objects.

keys

:class:UserKeyManager - Manager for :class: objects.

projects

:class:UserProjectManager - Manager for :class: 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)
  • skip_confirmation (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')]))
unblock(**kwargs)

Unblocks the user.

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

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.UserEmailManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for UserEmail objects.

UserEmail objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.UserKey(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.UserKeyManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for UserKey objects.

UserKey objects cannot be updated.

list(**kwargs)

Returns a list of objects of type 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 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 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.v4.objects.UserManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for User objects.

User objects can be updated.

list(**kwargs)

Returns a list of objects of type User.

Available keys for kwargs are:

  • active (optional)
  • blocked (optional)
  • username (optional)
  • extern_uid (optional)
  • provider (optional)
  • external (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 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 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)
  • skip_confirmation (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)
obj_cls

alias of User

class gitlab.v4.objects.UserProject(gl, data=None, **kwargs)

Bases: gitlab.base.GitlabObject

class gitlab.v4.objects.UserProjectManager(gl, parent=None, args=[])

Bases: gitlab.base.BaseManager

Manager for UserProject objects.

UserProject objects cannot be updated.

create(data, **kwargs)

Create an object of type 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 (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

gitlab.exceptions module

exception gitlab.exceptions.GitlabAuthenticationError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabError

exception gitlab.exceptions.GitlabBlockError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabBuildCancelError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabCancelError

exception gitlab.exceptions.GitlabBuildEraseError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabRetryError

exception gitlab.exceptions.GitlabBuildPlayError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabRetryError

exception gitlab.exceptions.GitlabBuildRetryError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabRetryError

exception gitlab.exceptions.GitlabCancelError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabCherryPickError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabConnectionError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabError

exception gitlab.exceptions.GitlabCreateError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabDeleteError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabError(error_message='', response_code=None, response_body=None)

Bases: exceptions.Exception

exception gitlab.exceptions.GitlabGetError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabJobCancelError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabCancelError

exception gitlab.exceptions.GitlabJobEraseError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabRetryError

exception gitlab.exceptions.GitlabJobPlayError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabRetryError

exception gitlab.exceptions.GitlabJobRetryError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabRetryError

exception gitlab.exceptions.GitlabListError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabMRClosedError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabMRForbiddenError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabMROnBuildSuccessError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabOperationError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabError

exception gitlab.exceptions.GitlabPipelineCancelError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabCancelError

exception gitlab.exceptions.GitlabPipelineRetryError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabRetryError

exception gitlab.exceptions.GitlabProjectDeployKeyError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabProtectError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabRetryError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabSubscribeError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabTimeTrackingError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabTodoError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabTransferProjectError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabUnblockError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabUnsubscribeError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

exception gitlab.exceptions.GitlabUpdateError(error_message='', response_code=None, response_body=None)

Bases: gitlab.exceptions.GitlabOperationError

gitlab.exceptions.raise_error_from_response(response, error, expected_code=200)

Tries to parse gitlab error message from response and raises error.

Do nothing if the response status is the expected one.

If response status code is 401, raises instead GitlabAuthenticationError.

Parameters:
  • response – requests response object
  • error – Error-class or dict {return-code => class} of possible error class to raise. Should be inherited from GitLabError