From 0ed641a26ec2200de00e4bbf3d170c767375351e Mon Sep 17 00:00:00 2001 From: Tom Hogans Date: Tue, 16 Aug 2011 02:00:11 -0400 Subject: [PATCH] Added docs regarding requests.session to docs/user/advanced.rst --- docs/user/advanced.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index e69de29..066ebde 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -0,0 +1,22 @@ +.. _advanced: + +Advanced Usage +============== + +This document covers more advanced features. + +Session Objects +=============== + +.. module:: requests.session + +The Session object allows you to persist certain parameters across requests. It also establishes a CookieJar by default and passes it along in any requests made from the Session instance. For a complete list of allowed parameters, please see the *__attrs__* field in *requests/session.py*. :: + + from requests.session import Session + + s = Session() + s.get("http://httpbin.org/cookies/set/sessioncookie/123456789") + r = s.get("http://httpbin.org/cookies") + print r.content + +Note: Certain parameters are best set at the request.config level (i.e. a global proxy, user agent header). -- 2.7.4