0
votes

I got such certificate :

certificate.base64.cer

-----BEGIN CERTIFICATE-----
MIIGGDCCBQCgAwIBAgITcwAHCoPQ7YzgDXiRHQACAAcKgzANBgkqhkiG9w0BAQsF
...(some symbols)
oWt63wOSxGxa3ASu1UFGCd9o+PxnaUA12EGU9A==
-----END CERTIFICATE-----

And I want to send request using it

api.py

session = requests.Session()
session.auth = HTTPBasicAuth('user', 'pass')
session.cert = 'path to .cer file'
host = 'https://api.com/webservices/MediaPool/?wsdl'
session.headers = {'Content-Type': 'application/json'}
client = Client(transport=Transport(session=session), wsdl=host)
response = client.service.uploadMedia(uploadMediaData={'fileName': image.name, 'fileData': image.read()})

but I get

HTTPSConnectionPool(host='some.host', port=443): Max retries exceeded with url: /webservices/MediaPool/?wsdl (Caused by SSLError(SSLError(9, '[SSL] PEM lib (_ssl.c:4050)'))

How to fix that? What is wrong?

1
There does not seem to be a key in the certificate file.Klaus D.

1 Answers

1
votes

Python requests trust certificate in cer-file

session.cert is used for authentication using client certificates. For specifying the trusted CA session.verify must be used instead. For more see the documentation.