Skip to content

SSL certificate projects list , 400 Bad Request  #1934

Closed
@X-rapido

Description

@X-rapido

Description of the problem, including code/CLI snippet

image

I need to request it locally with an SSL certificate,The following code

import gitlab
import requests
from requests_pkcs12 import Pkcs12Adapter

BASE_URL = "https://gitlab.co-xx.com"
session = requests.Session()
session.mount(BASE_URL, Pkcs12Adapter(pkcs12_filename='cert/client-20220301.p12', pkcs12_password='test'))
gl = gitlab.Gitlab(url=BASE_URL, private_token="8J9HsANQo8zFsUZEwShK", api_version=4, session=session)

if __name__ == '__main__':
    groups_list = gl.groups.list()
    for group in groups_list:
        print('组名:{} [{}]'.format(group.name, group.id))
        g_projects = group.projects.list(all=True)

        for g_project in g_projects:
            print(g_project)

Expected Behavior

Print the list of items correctly

raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabListError: 400: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
</body>
</html>

Actual Behavior

The group list prints correctly,However, an exception occurred in obtaining the projects list

Specifications

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions