uplink icon indicating copy to clipboard operation
uplink copied to clipboard

add docs about Client Side Certificates for 2-way ssl

Open wasdee opened this issue 4 years ago • 2 comments

I was expecting it in https://www.python-httpx.org/advanced/#ssl-certificates section.

I went to read the source code expecting parallel api like this. And I found it supported.

I search the docs again but it is mentioned on https://www.python-httpx.org/compatibility/#ssl-configuration and https://www.python-httpx.org/api/#helper-functions

I think it would be nice if the Advanced/SSL Section mention about this.

wasdee avatar Jan 20 '21 09:01 wasdee

I was also wondering how to pass client SSL certificates as part of auth. In fact I need to pass both basic auth along with the client ssl certificate and totally stumped on how to do this with uplink. In requests its easy, simply

requests.post(url, headers=headers, data=json.dumps(data), cert=(cert_file_path, key_file_path), auth=('user','password'))

Can someone provide guidance on how to do this with Uplink?

coreymunn3 avatar Feb 03 '22 21:02 coreymunn3

Hi, @coreymunn3 - If you need the cert for all requests, one option is to provide the cert using a requests.Session, as mentioned here: https://docs.python-requests.org/en/master/user/advanced/#client-side-certificates

This should work:

session = requests.Session()
session.cert = ...
consumer = MyConsumer(client=session)

prkumar avatar Feb 05 '22 07:02 prkumar