Merge branch 'develop' of https://github.com/chadnickbok/requests into develop
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by Kenneth Reitz · parents f6ed16b, fc618aa · Browse files · 3 files·+23 added−5 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−5 removed
- other:+23 added−5 removed
Provenance
- Commit
093709b- Tree
aa5b6be- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent 1
f6ed16b- Parent 2
fc618aa
3 files changed+23 added−5 removed
modified:requests/api.py+1 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 cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.37 """38 39 s = kwargs.pop('session') if 'session' in kwargs else sessions.session()40 return s.request(method=method, url=url, **kwargs)77 unmodified linesmodified:requests/models.py+14 added-2 removed
61 unmodified lines62 hooks=None,63 config=None,64 _poolmanager=None,65 verify=None,66- session=None):66+ session=None,67+ cert=None):68 69 #: Dictionary of configurations for this request.70 self.config = dict(config or [])71 71 unmodified lines143 144 #: SSL Verification.145 self.verify = verify146 147+ #: SSL Certificate148+ self.cert = cert149+150 if headers:151 headers = CaseInsensitiveDict(self.headers)152 else:153 headers = CaseInsensitiveDict()116 unmodified lines270 timeout=self.timeout,271 _poolmanager=self._poolmanager,272 proxies=self.proxies,273 verify=self.verify,270- session=self.session274+ session=self.session,275+ cert=self.cert276 )277 278 request.send()279 r = request.response231 unmodified lines511 else:512 conn.cert_reqs = 'CERT_NONE'513 conn.ca_certs = None514 515+ if self.cert:516+ if type(self.cert) is tuple:517+ conn.cert_file = self.cert[0]518+ conn.key_file = self.cert[1]519+ else:520+ conn.cert_file = self.cert521+522 if not self.sent or anyway:523 524 if self.cookies:525 303 unmodified linesmodified:requests/sessions.py+8 added-3 removed
50 unmodified lines51 """A Requests session."""52 53 __attrs__ = [54 'headers', 'cookies', 'auth', 'timeout', 'proxies', 'hooks',55- 'params', 'config', 'verify']55+ 'params', 'config', 'verify', 'cert']56 57 58 def __init__(self,59 headers=None,4 unmodified lines64 hooks=None,65 params=None,66 config=None,67 prefetch=False,68- verify=True):68+ verify=True,69+ cert=None):70 71 self.headers = headers or {}72 self.cookies = cookies or {}73 self.auth = auth3 unmodified lines77 self.params = params or {}78 self.config = config or {}79 self.prefetch = prefetch80 self.verify = verify81+ self.cert = cert82 83 for (k, v) in list(defaults.items()):84 self.config.setdefault(k, v)85 34 unmodified lines120 hooks=None,121 return_response=True,122 config=None,123 prefetch=False,122- verify=None):124+ verify=None,125+ cert=None):126 127 """Constructs and sends a :class:`Request <Request>`.128 Returns :class:`Response <Response>` object.129 11 unmodified lines141 :param return_response: (optional) If False, an un-sent Request object will returned.142 :param config: (optional) A configuration dictionary.143 :param prefetch: (optional) if ``True``, the response content will be immediately downloaded.144 :param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided.145+ :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.146 """147 148 method = str(method).upper()149 29 unmodified lines179 allow_redirects=allow_redirects,180 proxies=proxies,181 config=config,182 verify=verify,183+ cert=cert,184 _poolmanager=self.poolmanager185 )186 187 # Merge local kwargs with session kwargs.118 unmodified lines