python-gitlab / python-gitlab

A python wrapper for the GitLab API.

Home Page:https://python-gitlab.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

project.commits.list(path=some/path.txt) fails because "path" param is used to override path in ListMixin.list

dlachica opened this issue · comments

Description of the problem, including code/CLI snippet

gl.projects.get(1234).commits.list(path="some/path.txt", ref_name="some_branch")

Expected Behavior

Should properly create URL
https://giltab.instance.com/api/v4/projects/1234/repository/commits?path=some%2Fpath.txt&ref_name=some_branch

Actual Behavior

Generated URL
https://giltab.instance.com/api/v4some/path.txt?ref_name=some_branch

Caused by ListMixin.list
path = data.pop("path", self.path)

"path" should be supported as the API allows it
https://docs.gitlab.com/ee/api/commits.html#list-repository-commits

Specifications

  • python-gitlab version: 4.4.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 16.9.1

You will need to use query_parameters as discussed in https://python-gitlab.readthedocs.io/en/stable/api-usage.html