gitlab.v4 package

Submodules

gitlab.v4.objects module

class gitlab.v4.objects.ApplicationSettings(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ApplicationSettingsManager(gl, parent=None)

Bases: gitlab.mixins.GetWithoutIdMixin, gitlab.mixins.UpdateMixin, gitlab.base.RESTManager

update(*args, **kwargs)

Update an object on the server.

Parameters:
  • id – ID of the object to update (can be None if not required)
  • new_data – the update data for the object
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Returns:

The new object data (not a RESTObject)

Return type:

dict

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabUpdateError – If the server cannot perform the request
class gitlab.v4.objects.BroadcastMessage(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.BroadcastMessageManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.CurrentUser(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.CurrentUserEmail(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.CurrentUserGPGKey(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.CurrentUserGPGKeyManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.CurrentUserKey(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.CurrentUserManager(gl, parent=None)

Bases: gitlab.mixins.GetWithoutIdMixin, gitlab.base.RESTManager

class gitlab.v4.objects.DeployKey(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Dockerfile(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Event(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.EventManager(gl, parent=None)

Bases: gitlab.mixins.ListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Feature(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.FeatureManager(gl, parent=None)

Bases: gitlab.mixins.ListMixin, gitlab.base.RESTManager

set(*args, **kwargs)

Create or update the object.

Parameters:
  • name (str) – The value to set for the object
  • value (bool/int) – The value to set for the object
  • feature_group (str) – A feature group name
  • user (str) – A GitLab username
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabSetError – If an error occured
Returns:

The created/updated attribute

Return type:

obj

class gitlab.v4.objects.Gitignore(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Gitlabciyml(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Group(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

transfer_project(*args, **kwargs)

Transfer a project to this group.

Parameters:
  • to_project_id (int) – ID of the project to transfer
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabTransferProjectError – If the project could not be transfered
class gitlab.v4.objects.GroupAccessRequest(manager, attrs)

Bases: gitlab.mixins.AccessRequestMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.GroupAccessRequestManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupCustomAttribute(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.GroupCustomAttributeManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.SetMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupIssue(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupMember(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.GroupMemberManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.CreateMixin, gitlab.mixins.UpdateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupMergeRequest(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.GroupMergeRequestManager(gl, parent=None)

Bases: gitlab.base.RESTManager

class gitlab.v4.objects.GroupMilestone(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

issues(*args, **kwargs)

List issues related to this milestone.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

The list of issues

Return type:

RESTObjectList

merge_requests(*args, **kwargs)

List the merge requests related to this milestone.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

The list of merge requests

Return type:

RESTObjectList

class gitlab.v4.objects.GroupMilestoneManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupNotificationSettings(manager, attrs)

Bases: gitlab.v4.objects.NotificationSettings

class gitlab.v4.objects.GroupNotificationSettingsManager(gl, parent=None)

Bases: gitlab.v4.objects.NotificationSettingsManager

class gitlab.v4.objects.GroupProject(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupSubgroup(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.GroupSubgroupManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.GroupVariable(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.GroupVariableManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Hook(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.HookManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Issue(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.IssueManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.License(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Namespace(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.NotificationSettings(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.base.RESTObject

class gitlab.v4.objects.NotificationSettingsManager(gl, parent=None)

Bases: gitlab.mixins.GetWithoutIdMixin, gitlab.mixins.UpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.PagesDomain(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.PagesDomainManager(gl, parent=None)

Bases: gitlab.mixins.ListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Project(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

archive(*args, **kwargs)

Archive a project.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the server failed to perform the request
create_fork_relation(*args, **kwargs)

Create a forked from/to relation between existing projects.

Parameters:
  • forked_from_id (int) – The ID of the project that was forked from
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the relation could not be created
delete_fork_relation(*args, **kwargs)

Delete a forked relation between existing projects.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabDeleteError – If the server failed to perform the request
housekeeping(*args, **kwargs)

Start the housekeeping task.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabHousekeepingError – If the server failed to perform the request
repository_archive(*args, **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
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the server failed to perform the request
Returns:

The binary data of the archive

Return type:

str

repository_blob(*args, **kwargs)

Return a file by blob SHA.

Parameters:
  • sha (str) – ID of the blob
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the server failed to perform the request
Returns:

The blob content and metadata

Return type:

dict

repository_compare(*args, **kwargs)

Return a diff between two branches/commits.

Parameters:
  • from (str) – Source branch/SHA
  • to (str) – Destination branch/SHA
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the server failed to perform the request
Returns:

The diff

Return type:

str

repository_contributors(*args, **kwargs)

Return a list of contributors for the project.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the server failed to perform the request
Returns:

The contributors

Return type:

list

repository_raw_blob(*args, **kwargs)

Return the raw file contents for a blob.

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
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the server failed to perform the request
Returns:

The blob content if streamed is False, None otherwise

Return type:

str

repository_tree(*args, **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
  • recursive (bool) – Whether to get the tree recursively
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the server failed to perform the request
Returns:

The representation of the tree

Return type:

list

share(*args, **kwargs)

Share the project with a group.

Parameters:
  • group_id (int) – ID of the group.
  • group_access (int) – Access level for the group.
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the server failed to perform the request
star(*args, **kwargs)

Star a project.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the server failed to perform the request
trigger_pipeline(*args, **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 branch name or a tag
  • token (str) – The trigger token
  • variables (dict) – Variables passed to the build script
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the server failed to perform the request
unarchive(*args, **kwargs)

Unarchive a project.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabDeleteError – If the server failed to perform the request
unshare(*args, **kwargs)

Delete a shared project link within a group.

Parameters:
  • group_id (int) – ID of the group.
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabDeleteError – If the server failed to perform the request
unstar(*args, **kwargs)

Unstar a project.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabDeleteError – If the server failed to perform the request
upload(*args, **kwargs)

Upload the specified file into the project.

Note

Either filedata or filepath MUST be specified.

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

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

Return type:

dict

class gitlab.v4.objects.ProjectAccessRequest(manager, attrs)

Bases: gitlab.mixins.AccessRequestMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectAccessRequestManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectBoard(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.ProjectBoardList(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectBoardListManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectBoardManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectBranch(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

protect(*args, **kwargs)

Protect the branch.

Parameters:
  • developers_can_push (bool) – Set to True if developers are allowed to push to the branch
  • developers_can_merge (bool) – Set to True if developers are allowed to merge to the branch
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabProtectError – If the branch could not be protected
unprotect(*args, **kwargs)

Unprotect the branch.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabProtectError – If the branch could not be unprotected
class gitlab.v4.objects.ProjectBranchManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectCommit(manager, attrs)

Bases: gitlab.base.RESTObject

cherry_pick(*args, **kwargs)

Cherry-pick a commit into a branch.

Parameters:
  • branch (str) – Name of target branch
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCherryPickError – If the cherry-pick could not be performed
diff(*args, **kwargs)

Generate the commit diff.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the diff could not be retrieved
Returns:

The changes done in this commit

Return type:

list

class gitlab.v4.objects.ProjectCommitComment(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.ListMixin, gitlab.mixins.CreateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectCommitManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.CreateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectCommitStatus(manager, attrs)

Bases: gitlab.base.RESTObject, gitlab.mixins.RefreshMixin

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

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.CreateMixin, gitlab.base.RESTManager

create(data, **kwargs)

Create a new object.

Parameters:
  • data (dict) – Parameters to send to the server to create the resource
  • **kwargs – Extra data to send to the Gitlab server (e.g. sudo or ‘ref_name’, ‘stage’, ‘name’, ‘all’.
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the server cannot perform the request
Returns:

A new instance of the manage object class build with

the data sent by the server

Return type:

RESTObject

class gitlab.v4.objects.ProjectCustomAttribute(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectCustomAttributeManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.SetMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectDeployment(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectEnvironment(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectEnvironmentManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.CreateMixin, gitlab.mixins.UpdateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectEvent(manager, attrs)

Bases: gitlab.v4.objects.Event

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

Bases: gitlab.v4.objects.EventManager

class gitlab.v4.objects.ProjectFile(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

decode()

Returns the decoded content of the file.

Returns:the decoded content.
Return type:(str)
delete(branch, commit_message, **kwargs)

Delete the file from the server.

Parameters:
  • branch (str) – Branch from which the file will be removed
  • commit_message (str) – Commit message for the deletion
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabDeleteError – If the server cannot perform the request
save(branch, commit_message, **kwargs)

Save the changes made to the file to the server.

The object is updated to match what the server returns.

Parameters:
  • branch (str) – Branch in which the file will be updated
  • commit_message (str) – Message to send with the commit
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabUpdateError – If the server cannot perform the request
class gitlab.v4.objects.ProjectFileManager(gl, parent=None)

Bases: gitlab.mixins.GetMixin, gitlab.mixins.CreateMixin, gitlab.mixins.UpdateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

create(*args, **kwargs)

Create a new object.

Parameters:
  • data (dict) – parameters to send to the server to create the resource
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Returns:

a new instance of the managed object class built with

the data sent by the server

Return type:

RESTObject

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the server cannot perform the request
delete(*args, **kwargs)

Delete a file on the server.

Parameters:
  • file_path (str) – Path of the file to remove
  • branch (str) – Branch from which the file will be removed
  • commit_message (str) – Commit message for the deletion
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabDeleteError – If the server cannot perform the request
get(*args, **kwargs)

Retrieve a single file.

Parameters:
  • file_path (str) – Path of the file to retrieve
  • ref (str) – Name of the branch, tag or commit
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the file could not be retrieved
Returns:

The generated RESTObject

Return type:

object

raw(*args, **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
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the file could not be retrieved
Returns:

The file content

Return type:

str

update(*args, **kwargs)

Update an object on the server.

Parameters:
  • id – ID of the object to update (can be None if not required)
  • new_data – the update data for the object
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Returns:

The new object data (not a RESTObject)

Return type:

dict

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabUpdateError – If the server cannot perform the request
class gitlab.v4.objects.ProjectFork(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.CreateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectHook(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectHookManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectIssue(manager, attrs)

Bases: gitlab.mixins.SubscribableMixin, gitlab.mixins.TodoMixin, gitlab.mixins.TimeTrackingMixin, gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

move(*args, **kwargs)

Move the issue to another project.

Parameters:
  • to_project_id (int) – ID of the target project
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabUpdateError – If the issue could not be moved
user_agent_detail(*args, **kwargs)

Get user agent detail.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the detail could not be retrieved
class gitlab.v4.objects.ProjectIssueAwardEmoji(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectIssueAwardEmojiManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectIssueManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectIssueNote(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectIssueNoteAwardEmoji(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectIssueNoteAwardEmojiManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectIssueNoteManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectJob(manager, attrs)

Bases: gitlab.base.RESTObject, gitlab.mixins.RefreshMixin

artifact(*args, **kwargs)

Get a single artifact file from within the job’s artifacts archive.

Parameters:
  • path (str) – Path of the artifact
  • 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
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the artifacts could not be retrieved
Returns:

The artifacts if streamed is False, None otherwise.

Return type:

str

artifacts(*args, **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
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the artifacts could not be retrieved
Returns:

The artifacts if streamed is False, None otherwise.

Return type:

str

cancel(*args, **kwargs)

Cancel the job.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabJobCancelError – If the job could not be canceled
erase(*args, **kwargs)

Erase the job (remove job artifacts and trace).

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabJobEraseError – If the job could not be erased
keep_artifacts(*args, **kwargs)

Prevent artifacts from being deleted when expiration is set.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the request could not be performed
play(*args, **kwargs)

Trigger a job explicitly.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabJobPlayError – If the job could not be triggered
retry(*args, **kwargs)

Retry the job.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabJobRetryError – If the job could not be retried
trace(*args, **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
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the artifacts could not be retrieved
Returns:

The trace

Return type:

str

class gitlab.v4.objects.ProjectJobManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectKey(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

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

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

enable(*args, **kwargs)

Enable a deploy key for a project.

Parameters:
  • key_id (int) – The ID of the key to enable
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabProjectDeployKeyError – If the key could not be enabled
class gitlab.v4.objects.ProjectLabel(manager, attrs)

Bases: gitlab.mixins.SubscribableMixin, gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

save(*args, **kwargs)

Saves the changes made to the object to the server.

The object is updated to match what the server returns.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct.
  • GitlabUpdateError – If the server cannot perform the request.
class gitlab.v4.objects.ProjectLabelManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.CreateMixin, gitlab.mixins.UpdateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

delete(*args, **kwargs)

Delete a Label on the server.

Parameters:
  • name – The name of the label
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct.
  • GitlabDeleteError – If the server cannot perform the request.
class gitlab.v4.objects.ProjectManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectMember(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectMemberManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectMergeRequest(manager, attrs)

Bases: gitlab.mixins.SubscribableMixin, gitlab.mixins.TodoMixin, gitlab.mixins.TimeTrackingMixin, gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

cancel_merge_when_pipeline_succeeds(*args, **kwargs)

Cancel merge when the pipeline succeeds.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabMROnBuildSuccessError – If the server could not handle the request
changes(*args, **kwargs)

List the merge request changes.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

List of changes

Return type:

RESTObjectList

closes_issues(*args, **kwargs)

List issues that will close on merge.”

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

List of issues

Return type:

RESTObjectList

commits(*args, **kwargs)

List the merge request commits.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

The list of commits

Return type:

RESTObjectList

merge(*args, **kwargs)

Accept the merge request.

Parameters:
  • merge_commit_message (bool) – Commit message
  • should_remove_source_branch (bool) – If True, removes the source branch
  • merge_when_pipeline_succeeds (bool) – Wait for the build to succeed, then merge
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabMRClosedError – If the merge failed
participants(*args, **kwargs)

List the merge request participants.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

The list of participants

Return type:

RESTObjectList

class gitlab.v4.objects.ProjectMergeRequestAwardEmoji(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectMergeRequestAwardEmojiManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectMergeRequestDiff(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectMergeRequestManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectMergeRequestNote(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectMergeRequestNoteAwardEmoji(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectMergeRequestNoteAwardEmojiManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectMergeRequestNoteManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectMilestone(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

issues(*args, **kwargs)

List issues related to this milestone.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

The list of issues

Return type:

RESTObjectList

merge_requests(*args, **kwargs)

List the merge requests related to this milestone.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the list could not be retrieved
Returns:

The list of merge requests

Return type:

RESTObjectList

class gitlab.v4.objects.ProjectMilestoneManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectNote(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectNotificationSettings(manager, attrs)

Bases: gitlab.v4.objects.NotificationSettings

class gitlab.v4.objects.ProjectNotificationSettingsManager(gl, parent=None)

Bases: gitlab.v4.objects.NotificationSettingsManager

class gitlab.v4.objects.ProjectPagesDomain(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectPagesDomainManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectPipeline(manager, attrs)

Bases: gitlab.base.RESTObject, gitlab.mixins.RefreshMixin

cancel(*args, **kwargs)

Cancel the job.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabPipelineCancelError – If the request failed
retry(*args, **kwargs)

Retry the job.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabPipelineRetryError – If the request failed
class gitlab.v4.objects.ProjectPipelineJob(manager, attrs)

Bases: gitlab.v4.objects.ProjectJob

class gitlab.v4.objects.ProjectPipelineJobManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectPipelineJobsManager(gl, parent=None)

Bases: gitlab.mixins.ListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectPipelineManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.CreateMixin, gitlab.base.RESTManager

create(data, **kwargs)

Creates a new object.

Parameters:
  • data (dict) – Parameters to send to the server to create the resource
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabCreateError – If the server cannot perform the request
Returns:

A new instance of the managed object class build with

the data sent by the server

Return type:

RESTObject

class gitlab.v4.objects.ProjectPipelineSchedule(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

take_ownership(*args, **kwargs)

Update the owner of a pipeline schedule.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabOwnershipError – If the request failed
class gitlab.v4.objects.ProjectPipelineScheduleManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectPipelineScheduleVariable(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectPipelineScheduleVariableManager(gl, parent=None)

Bases: gitlab.mixins.CreateMixin, gitlab.mixins.UpdateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectProtectedBranch(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectProtectedBranchManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectRunner(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

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

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectService(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectServiceManager(gl, parent=None)

Bases: gitlab.mixins.GetMixin, gitlab.mixins.UpdateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

available(*args, **kwargs)

List the services known by python-gitlab.

Returns:The list of service code names.
Return type:list (str)
get(id, **kwargs)

Retrieve a single object.

Parameters:
  • id (int or str) – ID of the object to retrieve
  • lazy (bool) – If True, don’t request the server, but create a shallow object giving access to the managers. This is useful if you want to avoid useless calls to the API.
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Returns:

The generated RESTObject.

Return type:

object

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the server cannot perform the request
update(id=None, new_data={}, **kwargs)

Update an object on the server.

Parameters:
  • id – ID of the object to update (can be None if not required)
  • new_data – the update data for the object
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Returns:

The new object data (not a RESTObject)

Return type:

dict

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabUpdateError – If the server cannot perform the request
class gitlab.v4.objects.ProjectSnippet(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

content(*args, **kwargs)

Return the 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
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the content could not be retrieved
Returns:

The snippet content

Return type:

str

class gitlab.v4.objects.ProjectSnippetAwardEmoji(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectSnippetAwardEmojiManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectSnippetManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectSnippetNote(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectSnippetNoteAwardEmoji(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectSnippetNoteAwardEmojiManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

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

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectTag(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

set_release_description(*args, **kwargs)

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.
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • 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)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectTrigger(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

take_ownership(*args, **kwargs)

Update the owner of a trigger.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabOwnershipError – If the request failed
class gitlab.v4.objects.ProjectTriggerManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectUser(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.ProjectUserManager(gl, parent=None)

Bases: gitlab.mixins.ListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectVariable(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectVariableManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.ProjectWiki(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.ProjectWikiManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.Runner(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.RunnerManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.UpdateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

all(*args, **kwargs)

List all the runners.

Parameters:
  • scope (str) – The scope of runners to show, one of: specific, shared, active, paused, online
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the server failed to perform the request
Returns:

a list of runners matching the scope.

Return type:

list(Runner)

class gitlab.v4.objects.SidekiqManager(gl, parent=None)

Bases: gitlab.base.RESTManager

Manager for the Sidekiq methods.

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

compound_metrics(*args, **kwargs)

Return all available metrics and statistics.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the information couldn’t be retrieved
Returns:

All available Sidekiq metrics and statistics

Return type:

dict

job_stats(*args, **kwargs)

Return statistics about the jobs performed.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the information couldn’t be retrieved
Returns:

Statistics about the Sidekiq jobs performed

Return type:

dict

process_metrics(*args, **kwargs)

Return the registred sidekiq workers.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the information couldn’t be retrieved
Returns:

Information about the register Sidekiq worker

Return type:

dict

queue_metrics(*args, **kwargs)

Return the registred queues information.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the information couldn’t be retrieved
Returns:

Information about the Sidekiq queues

Return type:

dict

class gitlab.v4.objects.Snippet(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

content(*args, **kwargs)

Return the 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
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabGetError – If the content could not be retrieved
Returns:

The snippet content

Return type:

str

class gitlab.v4.objects.SnippetManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

public(*args, **kwargs)

List all the public snippets.

Parameters:
  • all (bool) – If True the returned object will be a list
  • **kwargs – Extra options to send to the server (e.g. sudo)
Raises:

GitlabListError – If the list could not be retrieved

Returns:

A generator for the snippets list

Return type:

RESTObjectList

class gitlab.v4.objects.Todo(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

mark_as_done(*args, **kwargs)

Mark the todo as done.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabTodoError – If the server failed to perform the request
class gitlab.v4.objects.TodoManager(gl, parent=None)

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

mark_all_as_done(*args, **kwargs)

Mark all the todos as done.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabTodoError – If the server failed to perform the request
Returns:

The number of todos maked done

Return type:

int

class gitlab.v4.objects.User(manager, attrs)

Bases: gitlab.mixins.SaveMixin, gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

block(*args, **kwargs)

Block the user.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabBlockError – If the user could not be blocked
Returns:

Whether the user status has been changed

Return type:

bool

unblock(*args, **kwargs)

Unblock the user.

Parameters:

**kwargs – Extra options to send to the server (e.g. sudo)

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabUnblockError – If the user could not be unblocked
Returns:

Whether the user status has been changed

Return type:

bool

class gitlab.v4.objects.UserActivities(manager, attrs)

Bases: gitlab.base.RESTObject

class gitlab.v4.objects.UserActivitiesManager(gl, parent=None)

Bases: gitlab.mixins.ListMixin, gitlab.base.RESTManager

class gitlab.v4.objects.UserCustomAttribute(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.UserCustomAttributeManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.SetMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.UserEmail(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

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

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.UserEvent(manager, attrs)

Bases: gitlab.v4.objects.Event

class gitlab.v4.objects.UserEventManager(gl, parent=None)

Bases: gitlab.v4.objects.EventManager

class gitlab.v4.objects.UserGPGKey(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.UserGPGKeyManager(gl, parent=None)

Bases: gitlab.mixins.RetrieveMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.UserImpersonationToken(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

class gitlab.v4.objects.UserImpersonationTokenManager(gl, parent=None)

Bases: gitlab.mixins.NoUpdateMixin, gitlab.base.RESTManager

class gitlab.v4.objects.UserKey(manager, attrs)

Bases: gitlab.mixins.ObjectDeleteMixin, gitlab.base.RESTObject

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

Bases: gitlab.mixins.GetFromListMixin, gitlab.mixins.CreateMixin, gitlab.mixins.DeleteMixin, gitlab.base.RESTManager

class gitlab.v4.objects.UserManager(gl, parent=None)

Bases: gitlab.mixins.CRUDMixin, gitlab.base.RESTManager

class gitlab.v4.objects.UserProject(manager, attrs)

Bases: gitlab.base.RESTObject

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

Bases: gitlab.mixins.ListMixin, gitlab.mixins.CreateMixin, gitlab.base.RESTManager

list(**kwargs)

Retrieve a list of objects.

Parameters:
  • all (bool) – If True, return all the items, without pagination
  • per_page (int) – Number of items to retrieve per request
  • page (int) – ID of the page to return (starts with page 1)
  • as_list (bool) – If set to False and no pagination option is defined, return a generator instead of a list
  • **kwargs – Extra options to send to the Gitlab server (e.g. sudo)
Returns:

The list of objects, or a generator if as_list is False

Return type:

list

Raises:
  • GitlabAuthenticationError – If authentication is not correct
  • GitlabListError – If the server cannot perform the request

Module contents