Python Requests Ssl Error With Combined .pem File
I have an internal server/api that is signed by an internal sub ca which was signed by the root ca. In my browsers the site is trusted and verified because the root ca and sub ca c
Solution 1:
Looks like you're using the wrong parameter to pass the path to the certificate bundle, your code should read:
r = requests.get('https://server/api', auth=(user,password), verify='/path/to/cert_bundle.pem')
The parameter used for verifying a remote certificate signed by a CA is verify
. If you only specify verify=True
then it will use a default internal root certificate store, but you can also pass in a path to your own store as in my code example.
The cert
parameter is for confirming your own identity to the remote server, which your server probably doesn't care about here.
Solution 2:
The parameter in session was wrong it is not cert it is verify....
import gitlab
import requests
session = requests.Session()
session.verify = 'ca_cert.pem'
domain = 'https://your.gitlab.server.com'
gl = gitlab.Gitlab(domain, private_token='your access token', api_version="4", session=session)
gl.auth()
pathToProject = "path/to/repo"
project = gl.projects.get(pathToProject)
items = project.repository_tree()
print(items)
Post a Comment for "Python Requests Ssl Error With Combined .pem File"