# gitlab-api-helper
This is a tool that calls the Gitlab API. It can query the list of projects, list branches of a specific project, and, after specifying the project and branch name, display the commit log.
# Installation
```
% pip install gitlab-api-helper
```
---
# Gitlab Setup
## Prepare the AccessToken
### Add a personal access token
https://gitlab.example.com/-/profile/personal_access_tokens
- read_api
- read_user
- read_repository
### Invite members
- Select a role
- Reporter
---
# Usage
```
% gitlab-api-helper --api https://gitlab.example.com/
{
"info": [
"config file not found: .env"
],
"result": {
"data": [],
"error": 0,
"errorMessage": null,
"status": true
},
"version": "1.0.0"
}
```
## Projects
```
% gitlab-api-helper --api https://gitlab.example.com --apiAccessToken 'glpat-XXXXXXXXXXXXX'
{
"info": [
"config file not found: .env"
],
"result": {
"data": [
{
"created_at": "2023-10-03T00:00:00.000+08:00",
"http_url_to_repo": "https://gitlab.example.com/web/test.git",
"id": 179,
"name": "test",
"name_with_namespace": "web / test",
"path": "test",
"path_with_namespace": "web/test",
"ssh_url_to_repo": "git@gitlab.example.com:web/test.git",
"web_url": "https://gitlab.example.com/web/test"
},
...
],
"error": 0,
"errorMessage": null,
"status": true
},
"version": "1.0.0"
}
```
## Branches
```
% gitlab-api-helper --api https://gitlab.example.com --apiAccessToken 'glpat-XXXXXXXXX' --lookup branch --lookupProjectID 1
{
"info": [
"config file not found: .env"
],
"result": {
"data": [
{
"name": "alpha",
"web_url": "https://gitlab.example.com/web/test/-/tree/alpha"
},
{
"name": "develop",
"web_url": "https://gitlab.example.com/web/test/-/tree/develop"
},
{
"name": "main",
"web_url": "https://gitlab.example.com/web/test/-/tree/main"
}
],
"error": 0,
"errorMessage": null,
"status": true
},
"version": "1.0.0"
}
```
## Commits
```
% gitlab-api-helper --api https://gitlab.example.com --apiAccessToken 'glpat-XXXXXXXXXXXX' --lookup commit --lookupProjectID 1 --lookupBranch develop
{
"info": [
"config file not found: .env",
"sinceISO8601FormatDateValue: 2023-10-03T00:00:00.281140"
],
"result": {
"data": [
{
"author_email": "user@gitlab.example.com",
"author_name": "user",
"committed_date": "2023-10-03T00:10:05.000+08:00",
"committer_email": "user@gitlab.example.com",
"created_at": "2023-10-03T00:10:05.000+08:00",
"id": "xxxxxxxxxxxxxxxxxxxxxx",
"message": "init\n",
"short_id": "xxxxx",
"title": "init"
},
...
],
"error": 0,
"errorMessage": null,
"status": true
},
"version": "1.0.0"
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/changyy/gitlab-api-helper",
"name": "gitlab-api-helper",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "python,gitlab,api,report,summary",
"author": "Yuan-Yi Chang",
"author_email": "<changyy.csie@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/1c/06/34d626fde17cf9e95f8413c1ba632623252828f930851eaa183cffbecff5/gitlab-api-helper-1.0.0.tar.gz",
"platform": null,
"description": "# gitlab-api-helper\n\nThis is a tool that calls the Gitlab API. It can query the list of projects, list branches of a specific project, and, after specifying the project and branch name, display the commit log.\n\n# Installation\n\n```\n% pip install gitlab-api-helper\n```\n\n---\n\n# Gitlab Setup\n\n## Prepare the AccessToken\n\n### Add a personal access token\n\nhttps://gitlab.example.com/-/profile/personal_access_tokens\n\n- read_api\n- read_user\n- read_repository\n\n### Invite members \n\n- Select a role\n - Reporter\n\n---\n\n# Usage\n\n```\n% gitlab-api-helper --api https://gitlab.example.com/\n{\n \"info\": [\n \"config file not found: .env\"\n ],\n \"result\": {\n \"data\": [],\n \"error\": 0,\n \"errorMessage\": null,\n \"status\": true\n },\n \"version\": \"1.0.0\"\n}\n```\n\n## Projects\n\n```\n% gitlab-api-helper --api https://gitlab.example.com --apiAccessToken 'glpat-XXXXXXXXXXXXX'\n{\n \"info\": [\n \"config file not found: .env\"\n ],\n \"result\": {\n \"data\": [\n {\n \"created_at\": \"2023-10-03T00:00:00.000+08:00\",\n \"http_url_to_repo\": \"https://gitlab.example.com/web/test.git\",\n \"id\": 179,\n \"name\": \"test\",\n \"name_with_namespace\": \"web / test\",\n \"path\": \"test\",\n \"path_with_namespace\": \"web/test\",\n \"ssh_url_to_repo\": \"git@gitlab.example.com:web/test.git\",\n \"web_url\": \"https://gitlab.example.com/web/test\"\n },\n ...\n ],\n \"error\": 0,\n \"errorMessage\": null,\n \"status\": true\n },\n \"version\": \"1.0.0\"\n}\n```\n\n## Branches\n\n```\n% gitlab-api-helper --api https://gitlab.example.com --apiAccessToken 'glpat-XXXXXXXXX' --lookup branch --lookupProjectID 1\n{\n \"info\": [\n \"config file not found: .env\"\n ],\n \"result\": {\n \"data\": [\n {\n \"name\": \"alpha\",\n \"web_url\": \"https://gitlab.example.com/web/test/-/tree/alpha\"\n },\n {\n \"name\": \"develop\",\n \"web_url\": \"https://gitlab.example.com/web/test/-/tree/develop\"\n },\n {\n \"name\": \"main\",\n \"web_url\": \"https://gitlab.example.com/web/test/-/tree/main\"\n }\n ],\n \"error\": 0,\n \"errorMessage\": null,\n \"status\": true\n },\n \"version\": \"1.0.0\"\n}\n```\n\n## Commits\n\n```\n% gitlab-api-helper --api https://gitlab.example.com --apiAccessToken 'glpat-XXXXXXXXXXXX' --lookup commit --lookupProjectID 1 --lookupBranch develop\n{\n \"info\": [\n \"config file not found: .env\",\n \"sinceISO8601FormatDateValue: 2023-10-03T00:00:00.281140\"\n ],\n \"result\": {\n \"data\": [\n {\n \"author_email\": \"user@gitlab.example.com\",\n \"author_name\": \"user\",\n \"committed_date\": \"2023-10-03T00:10:05.000+08:00\",\n \"committer_email\": \"user@gitlab.example.com\",\n \"created_at\": \"2023-10-03T00:10:05.000+08:00\",\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxx\",\n \"message\": \"init\\n\",\n \"short_id\": \"xxxxx\",\n \"title\": \"init\"\n },\n ...\n ],\n \"error\": 0,\n \"errorMessage\": null,\n \"status\": true\n },\n \"version\": \"1.0.0\"\n}\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "A simple tool that calls gitlab api to generate the repo summary",
"version": "1.0.0",
"project_urls": {
"Download": "https://pypi.org/project/gitlab-api-helper/",
"Homepage": "https://github.com/changyy/gitlab-api-helper"
},
"split_keywords": [
"python",
"gitlab",
"api",
"report",
"summary"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ada9c72e9507af1354e18fedcd2fa5de7cbdb8eb2671fb7bc9240c2a69251c71",
"md5": "4a973eaee81a79d9c43efd1549b1977b",
"sha256": "10ef4b8672f95b75d19821b17b478c1b9c62946d3256e121e9afdf05290418a0"
},
"downloads": -1,
"filename": "gitlab_api_helper-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4a973eaee81a79d9c43efd1549b1977b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5764,
"upload_time": "2023-10-03T16:25:31",
"upload_time_iso_8601": "2023-10-03T16:25:31.505707Z",
"url": "https://files.pythonhosted.org/packages/ad/a9/c72e9507af1354e18fedcd2fa5de7cbdb8eb2671fb7bc9240c2a69251c71/gitlab_api_helper-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1c0634d626fde17cf9e95f8413c1ba632623252828f930851eaa183cffbecff5",
"md5": "402611d64814c777644a279445b3f701",
"sha256": "cb1834d7ebe85c044b92184ed52decef3df83c81c1f41f587011cee253c0fee9"
},
"downloads": -1,
"filename": "gitlab-api-helper-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "402611d64814c777644a279445b3f701",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5142,
"upload_time": "2023-10-03T16:25:32",
"upload_time_iso_8601": "2023-10-03T16:25:32.929928Z",
"url": "https://files.pythonhosted.org/packages/1c/06/34d626fde17cf9e95f8413c1ba632623252828f930851eaa183cffbecff5/gitlab-api-helper-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-03 16:25:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "changyy",
"github_project": "gitlab-api-helper",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "gitlab-api-helper"
}