Permalink
Browse files

Merge pull request #1059 from Lukasa/sess_docs

Update session documentation.
  • Loading branch information...
2 parents b8affd9 + 1790b1d commit e23343ab17c7ab41d8f741724cc84c54963fb90f @kennethreitz kennethreitz committed Dec 22, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 docs/user/advanced.rst
View
@@ -26,12 +26,15 @@ Let's persist some cookies across requests::
# '{"cookies": {"sessioncookie": "123456789"}}'
-Sessions can also be used to provide default data to the request methods::
+Sessions can also be used to provide default data to the request methods. This
+is done by providing data to the properties on a session object::
headers = {'x-test': 'true'}
auth = ('user', 'pass')
- with requests.session(auth=auth, headers=headers) as c:
+ with requests.session() as c:
+ c.auth = auth
+ c.headers = headers
# both 'x-test' and 'x-test2' are sent
c.get('http://httpbin.org/headers', headers={'x-test2': 'true'})

0 comments on commit e23343a

Please sign in to comment.