I\'m developing an application for OS X. The application involves communicating with a server through python-requests, using a secure connection.
I am able to run the p
Requests uses a bundle of ceritificates to verify a servers identity.
This bundle is kept (it has to be) in an independent file. Normally requests ships with its own bundle, but if packaged into a single file the bundle is lost.
You can ship a new bundle alongside your app or let requests use the systemwide certificate.
(I don't know, where OS X keeps this file, but on my linux box its /etc/ssl/certs/ca-certificates.crt
)
To see, where requests expects the file you can do this:
import requests
print(requests.certs.where())
To change the location, where requests looks for the bundle you can pass the verify
-parameter with a string value:
import requests
requests.get("https://httpbin.org/", verify="path/to/your/bundle")
If you don't want to pass the parameter every time, create a session and configure it to use your bundle:
import requests
s = requests.Session()
s.verify = "path/to/your/bundle"
s.get("https://httpbin.org")