Skip to content
Myr

Clarification of keep-alive behavior.

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

The existing behavior was a little opaque for me--I was making a PUT request which returned a HTTP 204 with a 0-byte body. I was never reading the body and was wondering why my connections were not being reused.

authored by Bryan Berg · committed by Bryan Berg · parent a76f492 · Browse files · 1 file+2 added−0 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+2 added−0 removed

  • other:+2 added−0 removed

1 file+2 added−0 removed

modified:docs/user/advanced.rst+2 added
78 unmodified lines
79----------8081Excellent news — thanks to urllib3, keep-alive is 100% automatic within a session! Any requests that you make within a session will automatically reuse the appropriate connection!8283Note that connections are only released back to the pool for reuse once all body data has been read; be sure to either set ``prefetch`` to ``True`` or read the ``content`` property of the ``Response`` object.8485If you'd like to disable keep-alive, you can simply set the ``keep_alive`` configuration to ``False``::8687 s = requests.session()88 s.config['keep_alive'] = False
169 unmodified lines