Skip to content
Myr

:sparkles: connection pooling :sparkles: works :D

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 ae4e85f · Browse files · 2 files+7 added−4 removed
This commit

State

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

Diff stats

2 files+7 added−4 removed

  • other:+7 added−4 removed

2 files+7 added−4 removed

modified:requests/models.py+6 added-3 removed
120 unmodified lines
121122 def build(resp):123124 response = Response()125 response.config = self.config126 response.status_code = getattr(resp, 'status', None)127128 try:129 response.headers = CaseInsensitiveDict(getattr(resp, 'headers', None))
106 unmodified lines
236237 # Build the final URL.238 url = build_url(self.url, self.params)239239 print url240 # Setup Files.241 if self.files:242 pass243
15 unmodified lines
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)263 connection = pools.connection_from_url(url)264 # Part of a connection pool, so no fancy stuff. Sorry!265 do_block = True266267 # Create the connection.
75 unmodified lines
343344 #: A dictionary of Cookies the server sent back.345 self.cookies = None346347 #: A dictionary of configuration.348 self.config = None349350 def __repr__(self):351 return '<Response [%s]>' % (self.status_code)352353 def __nonzero__(self):
55 unmodified lines
409 except zlib.error:410 pass411412 # Decode unicode content.410 if settings.decode_unicode:413 if self.config.get('decode_unicode'):414 self._content = get_unicode_from_response(self)415416 self._content_consumed = True417 return self._content
19 unmodified lines
modified:requests/sessions.py+1 added-1 removed
110 unmodified lines
111 _kwargs[k] = v112113 # Add in PoolManager, if neccesary.114 if self.config.get('keepalive'):115 _kwargs['_pool'] = self.__pool115 _kwargs['_pools'] = self.__pool116117 # TODO: Persist cookies.118119 return func(*args, **_kwargs)
10 unmodified lines