-
Notifications
You must be signed in to change notification settings - Fork 673
Closed
Description
Description of the problem, including code/CLI snippet
When using the path
parameter in a project.commits.list
query, an incorrect URL is constructed.
import gitlab
import logging
logging.basicConfig(level=logging.DEBUG)
GITLAB_TOKEN = ''
GITLAB_URL = 'https://gitlab.example.com' # Fake url
PROJECT_ID = '7813'
TARGET_PATH = 'test_folder'
def list_commits_for_path(gl, project_id, path):
project = gl.projects.get(project_id)
new_commits = project.commits.list(path=path)
return new_commits
if __name__ == "__main__":
gl = gitlab.Gitlab(GITLAB_URL, private_token=GITLAB_TOKEN, ssl_verify=False)
commits = list_commits_for_path(gl, PROJECT_ID, TARGET_PATH)
for commit in commits:
print(f"- {commit.id[:8]} | {commit.author_name} | {commit.created_at} | {commit.title}")
Expected Behavior
The correct URL should look like this:
https://gitlab.example.com/api/v4/projects/7813/repository/commits?path=test_folder
Actual Behavior
Debug level log message:
DEBUG:urllib3.connectionpool:https://gitlab.example.com:443 "GET /api/v4test_folder HTTP/1.1" 404 37
Based on the log, it seems the URL might be the following:
https://gitlab.example.com/api/v4test_folder
Specifications
- python-gitlab version: 6.1.0
- Gitlab server version (or gitlab.com): GitLab Enterprise Edition - v17.5.5-ee
Metadata
Metadata
Assignees
Labels
No labels