Skip to content
Myr

Merge pull request #1059 from Lukasa/sess_docs

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

Update session documentation.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents b8affd9, 1790b1d · Browse files · 1 file+5 added−2 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+5 added−2 removed

  • other:+5 added−2 removed

1 file+5 added−2 removed

modified:docs/user/advanced.rst+5 added-2 removed
24 unmodified lines
25 print r.text26 # '{"cookies": {"sessioncookie": "123456789"}}'272829Sessions can also be used to provide default data to the request methods::29Sessions can also be used to provide default data to the request methods. This30is done by providing data to the properties on a session object::3132 headers = {'x-test': 'true'}33 auth = ('user', 'pass')3434 with requests.session(auth=auth, headers=headers) as c:35 with requests.session() as c:36 c.auth = auth37 c.headers = headers3839 # both 'x-test' and 'x-test2' are sent40 c.get('http://httpbin.org/headers', headers={'x-test2': 'true'})41
455 unmodified lines