Skip to content
Myr

pass around connections like pokémon cards

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 · parent 2d38f51 · Browse files · 1 file+10 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−7 removed

  • other:+10 added−7 removed

1 file+10 added−7 removed

modified:requests/api.py+10 added-7 removed
21 unmodified lines
222324def request(method, url,25 params=None, data=None, headers=None, cookies=None, files=None, auth=None,26 timeout=None, allow_redirects=False, proxies=None, hooks=None):26 timeout=None, allow_redirects=False, proxies=None, hooks=None,27 _connection=None):2829 """Constructs and sends a :class:`Request <Request>`.30 Returns :class:`Response <Response>` object.31
7 unmodified lines
39 :param auth: (optional) AuthObject to enable Basic HTTP Auth.40 :param timeout: (optional) Float describing the timeout of the request.41 :param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.42 :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.43 :param _connection: (optional) An HTTP Connection to re-use.44 """4546 method = str(method).upper()47
17 unmodified lines
65 files = files,66 auth = auth,67 timeout = timeout or config.settings.timeout,68 allow_redirects = allow_redirects,67 proxies = proxies or config.settings.proxies,69 proxies = proxies or config.settings.proxies70 )7172 # Arguments manipulation hook.73 args = dispatch_hook('args', hooks, args)7475 # Create Request object.76 r = Request(**args)7778 # Pre-request hook.79 r = dispatch_hook('pre_request', hooks, r)8081 # Send the HTTP Request.79 r.send()82 r.send(connection=_connection)8384 # Post-request hook.85 r = dispatch_hook('post_request', hooks, r)86
9 unmodified lines
96 :param url: URL for the new :class:`Request` object.97 :param **kwargs: Optional arguments that ``request`` takes.98 """9997 if "allow_redirects" not in kwargs:98 kwargs["allow_redirects"] = True100 if 'allow_redirects' not in kwargs:101 kwargs['allow_redirects'] = True102103 return request('get', url, **kwargs)104105
3 unmodified lines
109 :param url: URL for the new :class:`Request` object.110 :param **kwargs: Optional arguments that ``request`` takes.111 """112110 if "allow_redirects" not in kwargs:111 kwargs["allow_redirects"] = True113 if 'allow_redirects' not in kwargs:114 kwargs['allow_redirects'] = True115116 return request('head', url, **kwargs)117118
41 unmodified lines