summaryrefslogtreecommitdiff
path: root/docs/advanced-usage.rst
diff options
context:
space:
mode:
authorCory Benfield <lukasaoz@gmail.com>2016-09-05 13:17:53 +0100
committerGitHub <noreply@github.com>2016-09-05 13:17:53 +0100
commitcc9de256b8f3fba20bde0fe4d39d5554f1bb30b7 (patch)
treed7cf20b9a26ae4c7d32c33b0b170d396aab32a40 /docs/advanced-usage.rst
parent65b8c52c16dee5c3a523de2c1c21853ba0e581f2 (diff)
parent37565e8ed412da0dcc400e3f1ab624a34cc9f5c4 (diff)
downloadurllib3-sessionmanager.tar.gz
Merge pull request #904 from haikuginger/approved-session-managersessionmanager
Approved SessionManager changes
Diffstat (limited to 'docs/advanced-usage.rst')
-rw-r--r--docs/advanced-usage.rst29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/advanced-usage.rst b/docs/advanced-usage.rst
index f28c83c5..cb42ea0c 100644
--- a/docs/advanced-usage.rst
+++ b/docs/advanced-usage.rst
@@ -3,6 +3,35 @@ Advanced Usage
.. currentmodule:: urllib3
+SessionManager
+--------------
+
+:doc:`SessionManager(...) <manager>` is currently urllib3's most abstract manager
+level. Currently, it's in charge of creating and managing a :class:`~urllib3.util.context.SessionContext`
+object, which in turn will extract and apply cookies to and from each HTTP request
+and response that you make with that :class:`SessionManager`.
+
+By default, to create a `SessionManager`, you'll just create it; :class:`SessionManager` will handle
+creating a :class:`PoolManager` to actually make HTTP requests; meanwhile, :class:`SessionManager`
+will handle extracting and applying context to each request.
+
+You can also pass in another manager explicitly if you'd like different behavior:
+
+::
+
+ >>> proxy = urllib3.ProxyManager('http://localhost:3128/')
+ >>> session = urllib3.SessionManager(manager=proxy)
+
+If you want to customize the :class:`SessionContext` that your :class:`SessionManager`
+is using, just pass your own when initializing it:
+
+::
+
+ >>> liberal = urllib3.util.sessioncontext.DefaultCookiePolicy.DomainLiberal
+ >>> liberal_policy = urllib3.util.sessioncontext.DefaultCookiePolicy(strict_ns_domain=liberal)
+ >>> cj = urllib3.util.sessioncontext.CookieJar(policy=liberal_policy)
+ >>> context = urllib3.SessionContext(cookie_jar=cj)
+ >>> session = urllib3.SessionManager(manager=urllib3.PoolManager(), context=context)
Customizing pool behavior
-------------------------