Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Getting an error in filtering by path when listing commits#3101

Unanswered
ahmetdd asked this question inQ&A
Discussion options

Description of the problem, including code/CLI snippet

I want to get a commit list according to a specific folder in a branch, but I can't do this with the python module and I get an error.
This is provided by rest api but python module gets error with same parameters.
I run these commands respectively.

gitlab_api = Gitlab(url=args.gitlab_url, private_token=args.gitlab_token)gitlab_project = gitlab_api.projects.get(id=args.gitlab_project_id, all=True)gitlab_project.commits.list(ref_name='main', path='deployemnt/v1.31')

when I run Rest API I get results and no errors,

/api/v4/projects/4021212/repository/commits?ref_name=main&path=deployemnt/v1.31

Expected Behavior

Image

Actual Behavior

Details

gitlab.exceptions.GitlabHttpError: 404: 404 API Version Not FoundThe above exception was the direct cause of the following exception:Traceback (most recent call last):  File "<string>", line 1, in <module>  File "c:\Users\y79988\AppData\Local\pypoetry\Cache\virtualenvs\project-mLexHskk-py3.10\lib\site-packages\gitlab\exceptions.py", line 346, in wrapped_f    raise error(e.error_message, e.response_code, e.response_body) from egitlab.exceptions.GitlabListError: **404: 404 API Version Not Found**

## Specifications
  • python-gitlab version: "5.0.0"
  • Gitlab server version (or gitlab.com):v17.7.1
You must be logged in to vote

Replies: 2 comments 2 replies

Comment options

gitlab_project = gitlab_api.projects.get(id=args.gitlab_project_id, all=True)

Whyall=True?

Also which one of the three lines of your example has the error?

You must be logged in to vote
2 replies
@ahmetdd
Comment options

I removed all=true parameter then I tried again but nothing has changed, I still get the error.
Getting the error after this command. I can't get the commit list according to folder path
gitlab_project.commits.list(ref_name='main', path='deployemnt/v1.31')

@JohnVillalovos
Comment options

Ah!

path is used internally by the Python GitLab API. Probably a bad decision but it happened years ago.

So do it as suggested in:https://python-gitlab.readthedocs.io/en/main/api-usage.html#conflicting-parameters

gitlab_project.commits.list(query_parameters={"ref_name": "main", "path": "deployemnt/v1.31"})

Comment options

@JohnVillalovos I removed all=true parameter then I tried again but nothing has changed, I still get the error.
Getting the error after this command. I can't get the commit list according to folder path
gitlab_project.commits.list(ref_name='main', path='deployemnt/v1.31')

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@ahmetdd@JohnVillalovos
Converted from issue

This discussion was converted from issue #3100 on January 24, 2025 15:45.


[8]ページ先頭

©2009-2025 Movatter.jp