Feb-15-2022, 12:21 AM
Requests can do this.
Authentication with an X.509 certificate by specifying the path to the cert and key in your request.
Authentication with an X.509 certificate by specifying the path to the cert and key in your request.
requests.get('https://example.com', cert=('/path/client.cert', '/path/client.key'))A example how Requests work,using httpbin Request & Response Service.
import requests custom_header = {'user-agent': 'customUserAgent'} payload = {'website': 'python-forum.io'} url = 'http://httpbin.org/get' response = requests.get(url, headers=custom_header, params=payload)
>>> response.status_code 200 >>> >>> response.json() {'args': {'website': 'python-forum.io'}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Host': 'httpbin.org', 'User-Agent': 'customUserAgent', 'X-Amzn-Trace-Id': 'Root=1-620aefc7-6a0e69062220969551fe5a6f'}, 'origin': '83.143.86.74', 'url': 'http://httpbin.org/get?website=python-forum.io'}