Code for How to Add a TLS/SSL Certificate in Python Code Tutorial

basic_request.py

import requests

response = requests.get('https://www.google.com')
print(response.status_code)

add_simple_cert.py

import requests

response = requests.get('https://www.google.com', verify='/path/to/certificate.pem')
print(response.status_code)

self_signed.py

import requests

response = requests.get('https://self-signed.badssl.com/', verify='our-cert.pem')
print(response.status_code)

client_auth.py

import requests

# make a request to the server that require the client to provide a certificate for mutual auth
response = requests.get('https://client.badssl.com/', cert=('our-cert.pem', 'our-key.pem'))
print(response.status_code)