Skip to content

Can't list commit statuses; request is to the wrong URL #92

@cdbennett

Description

@cdbennett

Improper URLs are being sent in requests to the GitLab server for listing project commit statuses.

An example of what python-gitlab currently sends (as of v0.12.1) can be seen in the GitLab nginx access log:

"GET /api/v3/projects/34/statuses/f625542706870a50887ff00b2233cb1109661c76 HTTP/1.1" 405 2 "-" "python-requests/2.9.1"

You can see that GitLab response with a 405 error.

Cause

For some reason, the GitLab API has very different URLs for POSTing a new commit status and for getting or listing existing statuses for a commit.

GET /projects/:id/repository/commits/:sha/statuses
POST /projects/:id/statuses/:sha

-- GitLab CE API docs

Reproducing the problem

Example of testing it with Python:

gl=gitlab.Gitlab("http://ap-git.amx.internal/", private_token="XXXXXXXXXXXXXXXXXXXX")
g.projects.get("sandbox/msgparsedemo").commitstatuses.list(commit_id="f625542706870a50887ff00b2233cb1109661c76")

Example of testing it with CLI:

gitlab -v -c test.ini project-commit-status list --project-id=sandbox/msgparsedemo --commit-id=f625542706870a50887ff00b2233cb11096 61c76
Impossible to list objects (string indices must be integers)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions