{"id":15285887,"url":"https://github.com/doctormo/python-gitlab3","last_synced_at":"2025-04-13T02:41:14.113Z","repository":{"id":57434658,"uuid":"12313879","full_name":"doctormo/python-gitlab3","owner":"doctormo","description":"Python wrapper for the entire GitLab API","archived":false,"fork":false,"pushed_at":"2020-02-06T15:02:04.000Z","size":252,"stargazers_count":46,"open_issues_count":5,"forks_count":25,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T03:24:06.101Z","etag":null,"topics":["gitlab","gitlab-api","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doctormo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-23T03:43:51.000Z","updated_at":"2024-09-30T18:18:25.000Z","dependencies_parsed_at":"2022-09-04T15:23:36.410Z","dependency_job_id":null,"html_url":"https://github.com/doctormo/python-gitlab3","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctormo%2Fpython-gitlab3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctormo%2Fpython-gitlab3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctormo%2Fpython-gitlab3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctormo%2Fpython-gitlab3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doctormo","download_url":"https://codeload.github.com/doctormo/python-gitlab3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657850,"owners_count":21140843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitlab","gitlab-api","python"],"created_at":"2024-09-30T15:08:09.605Z","updated_at":"2025-04-13T02:41:14.092Z","avatar_url":"https://github.com/doctormo.png","language":"Python","readme":"# IMPORTANT!\n\nMartin Owens (@doctormo) has kindly taken over maintenance of this project.\n\n\n# python-gitlab3\n\nA Python wrapper for GitLab API v3.\n\nThere are existing python wrappers (notably, http://github.com/gpocentek/python-gitlab and http://github.com/Itxaka/python-gitlab), but I'm not fond of their interface/usage. In addition, this provides complete coverage of the GitLab API (and is easily maintainable).\n\n# Dependencies\n* [python-requests](http://docs.python-requests.org/en/latest/)\n\n# Installation\n\n```bash\n$ sudo pip install gitlab3\n```\n\n# Documentation\nSee http://alexvh.github.io/python-gitlab3/ for complete API information (also contained in the `doc` directory). Ancient-looking, Epydoc-generated html since it organizes this project more clearly than Sphinx does.\n\n# Example Usage\n```python\nimport gitlab3\n\ngl = gitlab3.GitLab('http://example.com/', 'token')\n# Alternatively:\ngl = gitlab3.GitLab('http://example.com/')\nif not gl.login('username_or_email', 'password'):\n    print \"Login failed\"\n\n#\n# Example usage involving listing objects\n#\nfor project in gl.projects():  # all of the current user's projects\n    print project.name\n\nfor event in gl.project(1).events(limit=10):  # 10 most recent events\n    print event.action_name\n\nfor project in gl.projects(page=1, per_page=10):  # pagination\n    print project.issues(limit=1)[0].title  # (assume issue[0] exists...)\n\n#\n# Sudo usage examples (GitLab v6.1+)\n# All functions accept an optional, undocumented, 'sudo' argument\n# specifiying a username or user id to act as.\n#\ngl.get_current_user(sudo='other_user')  # =\u003e 'other_user' CurrentUser object\ngl.projects(sudo=2)  # =\u003e list of user 2's projects\n# Alternatively, a 'with' statement can be used as follows:\nwith gl.sudo('other_user'):\n    gl.get_current_user()  # =\u003e 'other_user' CurrentUser object\n    gl.projects()  # =\u003e list of 'other_users's projects\n\n#\n# Example usage involving users\n#\nuser = gl.add_user('user@example.com', 'passwd', 'username',\n                   'real name', project_limit=50, bio='bio')\nprint type(user)  # =\u003e '\u003cclass 'gitlab3.User'\u003e'\nprint type(user.created_at)  # =\u003e '\u003ctype 'datetime.datetime'\u003e'\n\nuser = gl.user(1)  # or gl.get_user(1) - get_\u003cname\u003e() aliases \u003cname\u003e()\nuser.email = 'change@example.com'\nuser.save()  # or gl.update_user(user)\n\nuser.delete()  # or gl.delete_user(user)\n\n\n#\n# Example usage involving projects\n#\nproject = gl.project(1)  # or gl.get_project(1)\nprint project.description\nproject.events(limit=10)\n\n# Adding projects\ngl.add_project('my project', description='description', public=True)\ngl.add_project_for_user('user_id', 'test project', description='description')\n\n# Branches and tags\nbranch = project.branch('master')\nbranch.protect()\nproject.unprotect_branch('master')\ntags = project.tags()\n\n# Members\nmember = project.add_member('user_id', gitlab3.ACCESS_LEVEL_GUEST)\nmember.access_level = gitlab3.ACCESS_LEVEL_DEVELOPER\nmember.save()  # or project.update_member(member)\nproject.delete_member(member)\n\n# Issues\nissues = project.issues(limit=10)\nissue = project.add_issue('title', description='description')\nissue.add_note('note body')\nissue.close()\nissue.reopen()\n\n# Snippets\nsnippet = project.add_snippet('title', 'file_name', 'code')\nsnippet.delete()  # or project.delete_snippet(snippet)\nsnippet = project.snippet(1)\nsnippet_notes = snippet.notes()\n\n# Files and commits\nproject.commits() # list of commits in master branch\nproject.files()  # list of files in master branch\nproject.files(ref_name='other_branch')\nreadme_contents = project.get_blob('master', 'README')\n\n\n#\n# Example usage involving user teams\n#\nteams = gl.teams()\n\nteam = gl.add_team('team name', 'path')\nteam.add_member('user_id', gitlab3.ACCESS_LEVEL_GUEST)\nteam.add_project('project_id', gitlab3.ACCESS_LEVEL_MASTER)\n\n\n#\n# Find function examples\n# All objects that can be listed and obtained by an id have find functions.\n#\n# The find functions are simple, o(n), mostly unoptimized, and will request a\n# listing of objects on every call unless given a cached list.\n#\ngl.find_project(name='python-gitlab3')  # params can be any property of object\n\nprojects = gl.projects()\ngl.find_project(cached=projects, name='python-gitlab3')\ngl.find_project(cached=projects, find_all=True, public=True)  # public projects\ngl.find_project(cached=projects, find_all=True,\n                public=True, wiki_enabled=True)  # public projects with wikis\n\ngl.find_user(email='user@example.com')\n\nproject = gl.project(1)\nproject.find_member(username='user')\n\n# The GitLab API has support for more efficient searching of projects by name:\ngl.find_projects_by_name('name_query')  # Server-side search\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoctormo%2Fpython-gitlab3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoctormo%2Fpython-gitlab3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoctormo%2Fpython-gitlab3/lists"}