Python Forum
REST API x.509 authentication
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
REST API x.509 authentication
#2
Requests can do this.
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'}
Reply


Messages In This Thread
REST API x.509 authentication - by crossover - Feb-14-2022, 11:34 PM
RE: REST API x.509 authentication - by snippsat - Feb-15-2022, 12:21 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020