Skip to content
Myr

POOL PARTY!!!!!!!!!!!!!!!

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 e2af50b · Browse files · 4 files+16 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

4 files+16 added−5 removed

  • other:+16 added−5 removed

4 files+16 added−5 removed

modified:requests/_config.py+1 added
45 unmodified lines
46defaults['timeout'] = None47defaults['max_redirects'] = 3048defaults['decode_unicode'] = True49defaults['keepalive'] = True50defaults['max_connections'] = 105152
modified:requests/api.py+3 added-3 removed
22 unmodified lines
2324def 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,27 config=None, _connection=None):27 config=None, _pools=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.43 :param _pools: (optional) An HTTP PoolManager to use.44 """4546 method = str(method).upper()47 config = get_config(config)
31 unmodified lines
79 # Pre-request hook.80 r = dispatch_hook('pre_request', hooks, r)8182 # Send the HTTP Request.83 r.send(connection=_connection)83 r.send(pools=_pools)8485 # Post-request hook.86 r = dispatch_hook('post_request', hooks, r)87
73 unmodified lines
modified:requests/models.py+3 added-2 removed
225 unmodified lines
226 self.response.request = self227228229230 def send(self, connection=None, anyway=False):230 def send(self, pools=None, anyway=False):231 """Sends the shit."""232233 # Safety check.234 self._checks()
18 unmodified lines
253 if (anyway) or (not self.sent):254255 try:256 # Create a new HTTP connection, since one wasn't passed in.257 if not connection:257 if not pools:258 connection = urllib3.connection_from_url(url, timeout=self.timeout)259260 # One-off request. Delay fetching the content until needed.261 do_block = False262 else:263 connection = pools.connection_from_url(url, timeout=self.timeout)264 # Part of a connection pool, so no fancy stuff. Sorry!265 do_block = True266267 # Create the connection.
166 unmodified lines
modified:requests/sessions.py+9 added
12 unmodified lines
1314from . import api15from ._config import get_config16from .utils import add_dict_to_cookiejar17from .packages.urllib3.poolmanager import PoolManager181920def merge_kwargs(local_kwarg, default_kwarg):21 """Merges kwarg dictionaries.
42 unmodified lines
64 self.proxies = proxies65 self.hooks = hooks66 self.config = get_config(config)6768 self.__pool = PoolManager(69 num_pools=self.config.get('max_connections')70 )7172 # Map and wrap requests.api methods.73 self._map_api_methods()7475 def __repr__(self):
33 unmodified lines
109 for (k, v) in kwargs.items():110 if k not in _kwargs:111 _kwargs[k] = v112113 # Add in PoolManager, if neccesary.114 if self.config.get('keepalive'):115 _kwargs['_pool'] = self.__pool116117 # TODO: Persist cookies.118119 return func(*args, **_kwargs)120 return wrapper_func
9 unmodified lines