Python-gitlab api SSL bad handshake: Error ([("SSL routines", "ssl3_get_server_certificate", "certificate verification failed")],

I want to list all the problems in the github repository.

Python3 Code:

import gitlab
gl = gitlab.Gitlab('https://git.myinternalsite.com/project', private_token='XXXXXXXXXXXXXXX', api_version=4) 

issues = gl.issues.list()

This causes the following error:

SSLError: HTTPSConnectionPool (host = 'git.zonetrading.com', port = 443): The maximum number of attempts was exceeded using url: / cloudquant / user-issues / api / v4 / issues (caused by SSLError (SSLError (SSLError ("bad handshake : Error ([("SSL routines", "ssl3_get_server_certificate", "certificate verification failed")],) ",),))

Any ideas on how to fix the error?

+4
source share
2 answers

-.

TLS www.parkingcrew.com, git.zonetrading.com, certificate verify failed.

, , , git.zonetrading.com.

, , ssl_verify.

gl = gitlab.Gitlab('https://git.myinternalsite.com/project', private_token='XXXXXXXXXXXXXXX', api_version=4, ssl_verify=False) 
0

. :

... github , .

##########################################
# Dump one ticket to screen so you can see
# all the fields available.
##########################################
import pycurl
from io import BytesIO

buffer = BytesIO()

c = pycurl.Curl()

#
# using a private token from git. Had to register my token
# as a function within the github user profile settings
#
private_token = 'private_token=XXXXXMyPrivateTokenXXXXX'

#
# projects/3 - I had to dump the project list to find the id number 
# of the project that I wanted to get all the issues for
#
GitAPIurl = 'https://git.****MyDomain***.com/api/v4/projects/3/issues?{}'.format(private_token)

c.setopt(c.URL,GitAPIurl)
# turn off SSL verification because we don't have a proper SSL Certification
c.setopt(pycurl.SSL_VERIFYPEER, 0)
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()

body = []

body = buffer
# Body is a byte string.
# We have to know the encoding in order to print it to a text file
# such as standard output.

foo = {}
dictionary = json.loads(buffer.getvalue())
foo = dictionary[0]

print(foo)
0

Source: https://habr.com/ru/post/1691952/


All Articles