Commit Graph

153 Commits

Author SHA1 Message Date
Miikka Koskinen 5bb2be9a23 Use session cookies when following redirects
When a redirect was followed, only the cookies set by the initial
response were used in the follow-up request. Fixes #1228.
2013-03-12 18:43:58 +02:00
Florian Mueller c41932e184 Fixed some pickeling issues with HTTPAdapter and Session
Added trust_env and stream to Session.__attrs__. Initialize
self._pool_connections and self._pool_maxsize in HTTPAdapter.
2013-03-12 16:04:19 +01:00
Darjus Loktevic e706d18cf8 Pickling of Session and HTTPAdapter + a test
This is for issue #1088
2013-03-11 18:12:34 +00:00
Kenneth Reitz 99eead01a3 Merge pull request #1223 from andrewjesaitis/master
Fixes __getstate__ for session pickling
2013-03-04 14:52:31 -08:00
Andrew Jesaitis d60845303b Adds __attrs__ back to Session object 2013-03-04 11:07:29 -07:00
Kenneth Reitz 23d8522285 Revert "[kennethreitz/requests#1208] adding a max_retries argument"
This reverts commit 796d3225dd.
2013-03-03 12:01:38 -05:00
Kenneth Reitz d372a5b10b Merge pull request #1190 from mkomitee/master
Pass user options to hooks
2013-03-02 13:04:00 -08:00
Andrew Jesaitis 6a0845c984 Checks __attrs__ on session instance prior to iterating. 2013-02-28 15:13:57 -07:00
Wilfred Hughes 796d3225dd [kennethreitz/requests#1208] adding a max_retries argument 2013-02-27 16:01:23 +00:00
Chase Sterling 3f86e22a07 Make sure session cookies do not overwrite explicit request cookies
Implement RequestsCookieJar.copy
Use RequestsCookieJar.update when merging cookiejars
2013-02-16 00:56:59 -05:00
Michael Komitee d0285fac42 Use user supplied options when resending authenticated requests
Hooks sometimes have to send requests (e.g. when responding to a 401 during
authentication).

All keyword arguments should be passed along when hooks are dispatched so that
if a user wanted to use a timeout, stream, specify a cert location with the
verify flag, etc, their specification can be followed.
2013-02-13 19:11:38 -05:00
Ian Cordasco 4dfd6f3fc1 Dispatch hooks before following redirects
Fixes #1183
2013-02-12 23:00:06 -05:00
Piotr Dobrogost 4c8d1b9a7d removed no longer used redirect codes from models
added numeric values of redirect codes in comments
2013-02-11 23:07:12 +01:00
Ian Cordasco 2e31696156 Test and perfection for cookie handling.
I also fixed up some of the RequestsCookieJar methods so using
jar.update(other_jar) works without a problem. This cleans up some of the code
in sessions and the resolve_redirects method.
2013-02-10 19:36:36 -05:00
Ian Cordasco 9cdc8325ae Fix Setting a cookie on redirect 2013-02-10 17:43:37 -05:00
Ian Cordasco 9c8660dbb6 Resolve @piotr-dobrogost's concerns
Piotr had good objections to my not re-sending the body of the request on 307.
2013-02-10 17:14:45 -05:00
Ian Cordasco e7bc9bf1b2 Preserve the original request.
Let's make a copy to preserve it.
2013-02-10 17:11:16 -05:00
Ian Cordasco e2ad0d0fe8 We shouldn't be sending the data on redirect.
As such, we should remove the body from the old request as well as the
Content-Length header.
2013-02-10 17:11:16 -05:00
Ian Cordasco 3299771e34 Fix the potential issue mentioned in #1151
See: https://github.com/kennethreitz/requests/pull/1151#issuecomment-12905796

This is solved by just reusing the PreparedRequest from the last request.
2013-02-10 17:11:16 -05:00
Cory Benfield b0657cf163 Guard against users sending unprepared requests. 2013-02-10 06:13:02 +00:00
Kenneth Reitz 9fc7059140 Merge pull request #1151 from sigmavirus24/fix1133
Move redirect handling from Session.request to Session.send
2013-02-05 11:42:51 -08:00
Yehuda Sadeh b07c1ebd85 Fix POST 303 redirect resonse handling
This fixes issue #1156.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-01-31 11:23:09 -08:00
Ian Cordasco ba485913b6 Thanks to @maxcountryman for the code review 2013-01-30 10:58:32 -05:00
Ian Cordasco a95bfd3032 Fix the elapsed test and #1133 2013-01-29 23:50:37 -05:00
Ian Cordasco c8ad4f0b73 Move the timing work to Session.send
per @kennethreitz's request
2013-01-28 11:53:02 -05:00
oczkers 40a060cf57 it`s more pep8 now 2013-01-27 02:04:12 +01:00
Ian Cordasco 1cfe59299b Only call the hook once. 2013-01-23 11:51:37 -05:00
Ian Cordasco e771aa9386 Comment & replace something that keeps disappearing 2013-01-23 11:28:30 -05:00
sprt 088f908d58 Add missing import 2013-01-23 15:45:14 +01:00
sprt c4ad8afba9 Merge remote-tracking branch 'upstream/master'
Conflicts:
	requests/sessions.py
2013-01-23 14:42:45 +01:00
Ian Cordasco 27e814ad76 Fix failing tests. 2013-01-21 20:21:08 -05:00
Ian Cordasco e1c4fe21d4 Fix #1106 2013-01-19 11:49:52 -05:00
sprt a721d590b4 Make hooks work with prepared requests 2013-01-12 21:46:44 +01:00
Kenneth Reitz 1a7c91f658 Merge remote-tracking branch 'origin/master' 2013-01-10 02:13:06 -05:00
Kenneth Reitz 9d33629b6d don't supply params for directs
Closes #1070
2013-01-10 01:58:46 -05:00
Jian Li a392a87389 Retrieve kwargs.keys() just once. 2013-01-09 22:07:38 -08:00
Jian Li 68edcd12b1 Make merge_kwargs case-insensitive when looking up keys. 2013-01-09 21:29:24 -08:00
Kenneth Reitz fcccc82282 Merge remote-tracking branch 'origin/master' 2012-12-23 01:40:12 -05:00
Kenneth Reitz 3ddcc99131 docs update 2012-12-23 01:40:07 -05:00
David Bonner 7d085b188c fix POST redirects
the redirect handling logic compares then method to upper-case strings,
so make sure the method gets upper-cased as well.

add a test to POST to /status/302 on httpbin, which fails against httpbin.org
right now.  i'm submitting a pull request over there to fix that right after
this one.  once that's accepted, the new test verifies that the fix works.
2012-12-23 00:51:26 -05:00
Hans Lellelid bfef8d99c8 Updated API docs for 'data' param in sessions module to indicate that file-like object is also supported. 2012-12-20 09:47:29 -05:00
Ian Cordasco 14da5cf180 A possible fix for #1036
I can only assume that the only possible thing to close on a session are the
adapters. As such, I wrote the close method for a session object which closes
all possible adapters.
2012-12-18 09:43:55 -05:00
Kenneth Reitz 6acce57271 no kwargs 2012-12-18 05:01:32 -05:00
Bryce Boe e355d6ac6c Fix issue 1027. Always persist cookies. 2012-12-17 17:13:18 -08:00
Kenneth Reitz 27c6dc3735 Merge pull request #1020 from Lukasa/misc
Fix off-by-one error.
2012-12-17 10:46:09 -08:00
Cory Benfield 8b1b706903 Fix off-by-one error. 2012-12-17 18:42:32 +00:00
Kenneth Reitz 1e64fbcb55 CURL_CA_BUNDLE 2012-12-17 13:41:20 -05:00
Kenneth Reitz 1451ba0c6d update docs 2012-12-17 08:33:18 -05:00
Kenneth Reitz a982b0d903 proxy manager 2012-12-17 07:21:10 -05:00
Kenneth Reitz c3431bb6f2 tension 2012-12-17 07:01:59 -05:00