Merge branch 'develop'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by Kenneth Reitz · parents 82e8fdb, d938f32 · Browse files · 4 files·+43 added−5 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+43 added−5 removed
- other:+43 added−5 removed
Provenance
- Commit
23efd56- Tree
9133df0- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent 1
82e8fdb- Parent 2
d938f32
4 files changed+43 added−5 removed
modified:requests/core.py+2 added-2 removed
10 unmodified lines11 12 """13 14 __title__ = 'requests'15-__version__ = '0.6.5'16-__build__ = 0x00060515+__version__ = '0.6.6'16+__build__ = 0x00060617 __author__ = 'Kenneth Reitz'18 __license__ = 'ISC'19 __copyright__ = 'Copyright 2011 Kenneth Reitz'20 9 unmodified linesmodified:requests/sessions.py+4 added-2 removed
47 unmodified lines48 49 class Session(object):50 """A Requests session."""51 52- __attrs__ = ['headers', 'cookies', 'auth', 'timeout', 'proxies', 'hooks']52+ __attrs__ = ['headers', 'cookies', 'auth', 'timeout', 'proxies', 'hooks', 'params']53 54 55 def __init__(self,56 headers=None,57 cookies=None,58 auth=None,59 timeout=None,60 proxies=None,61- hooks=None):61+ hooks=None,62+ params=None):63 64 self.headers = headers or {}65 self.cookies = cookies or {}66 self.auth = auth67 self.timeout = timeout68 self.proxies = proxies or {}69 self.hooks = hooks or {}70+ self.params = params or {}71 72 # Set up a CookieJar to be used by default73 self.cookies = cookielib.FileCookieJar()74 61 unmodified linesmodified:HISTORY.rst+9 added-1 removed
1 History2 -------3 4-0.6.5 (2011-10-19)4+0.6.6 (2011-10-19)5 ++++++++++++++++++6 7+* Session parameter bugfix (params merging)8+9+10+0.6.5 (2011-10-18)11+++++++++++++++++++12+13 * Offline (fast) test suite.14 * Session dictionary argument merging.15 16 5 unmodified lines22 * Removal of ``r.read/close`` methods23 * New ``r.faw`` interface for advanced response usage.*24 * Automatic expansion of parameterized headers25 26+27 0.6.3 (2011-10-13)28 ++++++++++++++++++29 30 * Beautiful ``requests.async`` module, for making async requests w/ gevent.31 32+33 0.6.2 (2011-10-09)34 ++++++++++++++++++35 36 * GET/HEAD obeys allow_redirects=False160 unmodified linesmodified:test_requests.py+28 added
466 unmodified lines467 468 self.assertEqual(r2.status_code, 200)469 470 471+ def test_session_persistent_params(self):472+473+ params = {'a': 'a_test'}474+475+ s = Session()476+ s.params = params477+478+ # Make 2 requests from Session object, should send header both times479+ r1 = s.get(httpbin('get'))480+ assert params['a'] in r1.content481+482+483+ params2 = {'b': 'b_test'}484+485+ r2 = s.get(httpbin('get'), params=params2)486+ assert params['a'] in r2.content487+ assert params2['b'] in r2.content488+489+490+ params3 = {'b': 'b_test', 'a': None, 'c': 'c_test'}491+492+ r3 = s.get(httpbin('get'), params=params3)493+494+ assert not params['a'] in r3.content495+ assert params3['b'] in r3.content496+ assert params3['c'] in r3.content497+498+499 if __name__ == '__main__':500 unittest.main()