Exposed key_file and cert_file in requests, to support https client certificates.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by chadnickbok@gmail.com · committed by chadnickbok@gmail.com · parent cc4381b · Browse files · 3 files·+23 added−3 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+23 added−3 removed
- other:+23 added−3 removed
Provenance
- Commit
82e69de- Tree
18abb6b- Author
chadnickbok@gmail.com <chad@gaikai.com>- Committer
chadnickbok@gmail.com <chad@gaikai.com>- Parent
cc4381b
3 files changed+23 added−3 removed
modified:requests/api.py+2 added
31 unmodified lines32 :param session: (optional) A :class:`Session` object to be used for the request.33 :param config: (optional) A configuration dictionary.34 :param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided.35 :param prefetch: (optional) if ``True``, the response content will be immediately downloaded.36+ :param key_file: (optional) ssl client key file.37+ :param cert_file: (optional) ssl client cert file.38 """39 40 s = kwargs.pop('session') if 'session' in kwargs else sessions.session()41 return s.request(method=method, url=url, **kwargs)77 unmodified linesmodified:requests/models.py+11 added-1 removed
61 unmodified lines62 hooks=None,63 config=None,64 _poolmanager=None,65 verify=None,66- session=None):66+ session=None,67+ key_file=None,68+ cert_file=None):69 70 #: Dictionary of configurations for this request.71 self.config = dict(config or [])72 71 unmodified lines144 145 #: SSL Verification.146 self.verify = verify147 148+ #: SSL Certificate149+ self.key_file = key_file150+ self.cert_file = cert_file151+152 if headers:153 headers = CaseInsensitiveDict(self.headers)154 else:155 headers = CaseInsensitiveDict()356 unmodified lines512 else:513 conn.cert_reqs = 'CERT_NONE'514 conn.ca_certs = None515 516+ if self.key_file and self.cert_file:517+ conn.key_file = self.key_file518+ conn.cert_file = self.cert_file519+520 if not self.sent or anyway:521 522 if self.cookies:523 303 unmodified linesmodified:requests/sessions.py+10 added-2 removed
75 unmodified lines76 hooks=None,77 params=None,78 config=None,79 prefetch=False,80- verify=True):80+ verify=True,81+ key_file=None,82+ cert_file=None):83 84 self.headers = headers or {}85 self.cookies = cookies or {}86 self.auth = auth3 unmodified lines90 self.params = params or {}91 self.config = config or {}92 self.prefetch = prefetch93 self.verify = verify94+ self.key_file = key_file95+ self.cert_file = cert_file96 97 for (k, v) in list(defaults.items()):98 self.config.setdefault(k, v)99 34 unmodified lines134 hooks=None,135 return_response=True,136 config=None,137 prefetch=False,134- verify=None):138+ verify=None,139+ key_file=None,140+ cert_file=None):141 142 """Constructs and sends a :class:`Request <Request>`.143 Returns :class:`Response <Response>` object.144 48 unmodified lines193 allow_redirects=allow_redirects,194 proxies=proxies,195 config=config,196 verify=verify,197+ key_file=key_file,198+ cert_file=cert_file,199 _poolmanager=self.poolmanager200 )201 202 # Merge local kwargs with session kwargs.118 unmodified lines