Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests Like Client Certification #285

Open
yesennes opened this issue May 1, 2020 · 1 comment
Open

Requests Like Client Certification #285

yesennes opened this issue May 1, 2020 · 1 comment

Comments

@yesennes
Copy link

yesennes commented May 1, 2020

In requests, you can specify the client cert with an optional parameter like: requests.get(url, cert=[client_cert_location, client_cert_key_location]). I would be nice to be able to specify the client cert in the same way.

@twm
Copy link
Contributor

twm commented Jun 6, 2020

Unfortunately I think that the specific API exposed by requests (the cert argument) is in conflict with another Treq feature: the ability to pass a custom Agent. Control over TLS options is a parameter to the agent, but since Treq doesn't necessarily instantiate the agent we can't necessarily pass it.

The capability is available, though: when instantiating the Agent pass the agent a custom IPolicyForHTTPS that uses optionsForClientTLS to specify a client certificate.

I do think that Treq could make this cleaner. Perhaps expose an API for composing agents like Treq does internally inside HTTPClient, and extend that to support client certificates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants