5

Is there a way to tell the requests lib to add multiple certificates like all .pem files from a specified folder?

import requests, glob
CERTIFICATES = glob('/certs/')
url = '127.0.0.1:8080'
requests.get(url, cert=CERTIFICATES)

Seems to work only for a single certificate

I already search google and the python doc. The best tutorial I found was the SSL certification section in the official documentation.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
PlagTag
  • 6,107
  • 6
  • 36
  • 48

1 Answers1

5

You can only pass in one certificate file at a time.

Either merge those files into one .pem file, or loop over the certificate files and try each one in turn until the connection succeeds.

A .pem file can hold multiple certificates; it should be safe to concatenate all your files together. See http://how2ssl.com/articles/working_with_pem_files/.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343