A mimic inspired by the session feature in Requests, it adds support to Tornado that allows you to persist context such as cookies and other parameters across requests' fetching from tornado.httpclient.
THIS IS SESSION ABOUT CLIENT, NOT SERVER!
pip install tornado-httpclient-session
from tornado.httpclient import HTTPClient
from httpclient_session import Session
s = Session(HTTPClient) # AsyncHTTPClient default
r = s.fetch('https://github.com')
print(r.headers['set-cookie']) # Inspect cookies returnd from Github
r = s.fetch('https://github.com') # Fetching carrys cookies
print(r.request.headers['cookie']) # Inspect cookies attached
python setup.py test
Or for all supported environments:
tox
Persistences of:
- Cookies ✔
- Referrer ✘
- Authorization ✘