Skip to content
Myr

keep_alive is now disable-able!

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 7192b80 · Browse files · 3 files+11 added−6 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+11 added−6 removed

  • other:+11 added−6 removed

3 files+11 added−6 removed

modified:requests/defaults.py+1 added-1 removed
33 unmodified lines
34defaults['timeout'] = None35defaults['max_redirects'] = 3036defaults['decode_unicode'] = True37defaults['timeout_fallback'] = True38# defaults['keep_alive'] = True38defaults['keep_alive'] = True39defaults['pool_connections'] = 1040defaults['pool_maxsize'] = 141defaults['max_retries'] = 042defaults['safe_mode'] = False
modified:requests/models.py+8 added-2 removed
18 unmodified lines
19from .hooks import dispatch_hook20from .structures import CaseInsensitiveDict21from .status_codes import codes22from .packages.urllib3.exceptions import MaxRetryError23from .packages.urllib3 import connectionpool24from .exceptions import (25 Timeout, URLRequired, TooManyRedirects, HTTPError, ConnectionError)26from .utils import (27 dict_from_cookiejar, get_unicode_from_response,
324 unmodified lines
352353 self.__dict__.update(r.__dict__)354355356 if self.config.get('keep_alive'):355 conn = self._poolmanager.connection_from_url(url)357 conn = self._poolmanager.connection_from_url(url)358 else:359 conn = connectionpool.connection_from_url(url)360 print 'NO CONNECTION FOR YOU1'361362 if not self.sent or anyway:363364 if self.cookies:
12 unmodified lines
377 # Attach Cookie header to request.378 self.headers['Cookie'] = cookie_header379380 try:376 # Create the connection.381 # Send the request.382 r = conn.urlopen(383 method=self.method,384 url=url,385 body=body,
3 unmodified lines
389 preload_content=False,390 decode_content=False,391 retries=self.config.get('max_retries', 0)392 )393394 except MaxRetryError, e:395 if not self.config.get('safe_mode', False):396 raise ConnectionError(e)397 else:
158 unmodified lines
modified:test_requests.py+2 added-3 removed
55 unmodified lines
5657 def tearDown(self):58 """Teardown."""59 # self.httpbin.kill()60 pass616263 def test_entry_points(self):6465 requests.session66 requests.session().get
485 unmodified lines
552 r = requests.get(hah, allow_redirects=False, config=config)553 assert r.content == None554555554555556556if __name__ == '__main__':557 unittest.main()