Commit Graph

1948 Commits

Author SHA1 Message Date
kennethreitz 456be3cfde Merge pull request #3024 from Stranger6667/utils-unit-tests
Added unit tests for utils module
2016-04-06 15:05:13 -04:00
kennethreitz 03ed671a41 Merge pull request #3059 from alexanderad/proxy-connection-errors
Raise a ProxyError for proxy related connection issues
2016-04-06 15:01:25 -04:00
Alexander Hermes b8a577050d Update docstring and API doc to document ability to add per-file headers in multipart POST
* Docstring only change - for the function itself cf. requests Issue #1640
2016-03-29 11:57:47 +01:00
Ben f24d56a1ce Consolidate logic for changing method during redirects
I only moved the code into a function, there was no actual change to
the code. I added a few tests to ensure we're doing things correctly.

The real point of me doing this is to make it easier to bring back
`strict_mode` functionality. For you requests youngsters in the crowd,
`strict_mode` followed the spec for redirects meaning the method
wouldn't change to a GET. The current code follows the browser
convention of changing the method to a GET when doing a 302 redirect.
However, lots of servers want you to follow the standards (the nerve!)
so I'd like to override the logic. Now that the method changing logic
is in `rebuild_method`, I can simply override that function instead of
overriding the entire `resolve_redirects` function as suggested by
kennethreitz/requests#1325
2016-03-17 23:16:39 -05:00
Alexander Shchapov 6ca9d71bb5 Raise a ProxyError for proxy related connection issues. 2016-03-17 15:46:26 -04:00
Dmitry Dygalo 1eb153529a Merge remote-tracking branch 'upstream/master' into utils-unit-tests
Conflicts:
	tests/test_utils.py
2016-03-13 10:24:47 +01:00
Ian Cordasco 190cddd4ae Merge pull request #3036 from Lukasa/issue/3035
Allow for exceptions from tell()
2016-03-11 07:30:53 -06:00
Brandon Sandrowicz ee060ba7f3 Fix api.rst References
api.rst references `requests.ConnectTimeout` and `requests.ReadTimeout`, but they aren't imported into the top-level of the package.
2016-03-08 23:51:46 -05:00
Cory Benfield 6cc0b56d51 Switch to treat files without tell() as zero-length 2016-03-07 09:05:43 +00:00
Cory Benfield e034dd1140 Allow for exceptions from tell() 2016-03-07 08:31:23 +00:00
Casey Davidson d8b36c1718 Override __contains__ method of RequestsCookieJar to catch CookieConflictError. Refs #3028 2016-03-04 15:55:43 -08:00
Dmitry Dygalo f123f89d32 Added unit tests for utils module 2016-02-19 10:32:23 +01:00
kennethreitz b0704b86de years 2016-02-18 14:16:50 -05:00
kennethreitz fc512d8924 Don't use redirect_cache if allow_redirects=False
Fix for #2997
2016-02-05 17:51:09 -05:00
Markus Unterwaditzer 2140c98fa4 Fix syntax error 2016-01-30 19:59:58 +01:00
kennethreitz 6195edc075 cleanup of auth __eq__ 2016-01-29 22:18:07 -05:00
kennethreitz f7447d1871 Merge pull request #2958 from Malizor/master
Add equality functions for authentication handlers
2016-01-29 22:08:26 -05:00
Carson Lam a02069ec9e Remove int type on max_retries argument. 2016-01-29 15:30:22 -08:00
Ryan Munro 6a8a480d6c Review changes to TooManyRedirect exception with response 2016-01-20 10:48:12 -08:00
Ryan Munro e6f218f3f6 Return request & response with TooManyRedirects 2016-01-19 16:44:58 -08:00
Nicolas Delvaux 06df08e676 Add equality functions for authentication handlers 2016-01-04 17:01:06 +01:00
Cory Benfield 1108058626 v2.9.1 2015-12-21 14:53:36 +00:00
Ian Cordasco 06a411c289 Merge pull request #2937 from Lukasa/release/2.9.1
Release 2.9.1
2015-12-21 08:51:21 -06:00
Cory Benfield 6e0649d9f8 Push code review advice from @sigmavirus24 2015-12-19 08:44:21 +00:00
Cory Benfield 834a9601c3 Update urllib3 to 1.13.1 2015-12-19 08:40:39 +00:00
Cory Benfield 589f13ca9d Handle bytes and unicode URLs for netloc 2015-12-18 09:22:23 +00:00
Cory Benfield 96a068b58e Merge branch 'master' into fix-1859 2015-12-18 09:14:13 +00:00
Cory Benfield fc8fa1aa26 Fix regression from #2844 regarding binary bodies. 2015-12-16 14:56:13 +00:00
Cory Benfield 5f7a3a74aa v2.9.0 2015-12-15 15:29:27 +00:00
Cory Benfield 3c0f0b9ab5 Update urllib3 to 1.13 2015-12-15 14:47:20 +00:00
Brian Samek 9aca57d4bf Revert changes to params
This reverts commit 9a20afd6b5.

Docstring changes were desirable, but changes to params were not.
2015-12-11 16:47:47 -05:00
Brian Samek 9a20afd6b5 Refactor default params
Specified the default argument for params that have a default in the docstring
so that the default is easier to see from the code. Modified the docstring in
api.py to match the docstring in sessions.py.
2015-12-11 13:32:09 -05:00
Brian Samek 3ad66349ea Add hint to :param verify.
It is not clear that :param verify defaults to True. The way the verify
portion of the docstring is written it looks like it defaults to False, and
you have to pass in True if you'd like the SSL cert to be verified, but the
opposite is the case.
2015-12-09 11:21:21 -05:00
Matt Jordan 5c19d3e07b requests/auth: Handle an empty 'qop' attribute in a Authenticate challenge
Some malfunctioning HTTP servers may return a qop directive with no token, as
opposed to correctly omitting the qop directive completely. For example:

header: WWW-Authenticate: Digest realm="foobar_api_auth", qop="",
        nonce="a12059eaaad0b86ece8f62f04cbafed6", algorithm="MD5",
        stale="false"

Prior to this patch, requests would respond with a 'None' Authorization header.
While the server is certainly incorrect, this patch updates requests to be
more tolerant to this kind of shenaniganry. If we receive an empty string for
the value of the qop attribute, we instead treat that as if the qop attribute
was simply not provided.

Closes #2916
2015-12-05 16:14:52 -06:00
Ian Cordasco 40ce36671c Merge pull request #2896 from BraulioVM/master
[WIP] Set 'Transfer-Encoding: chunked' if data is a file with length 0
2015-12-02 08:35:41 -06:00
Jakub Wilk 23d9b077d8 Fix typos 2015-12-01 12:24:56 +01:00
Olle Lundberg 68db4132e3 Update adapters.py
Remove duplicate word.
2015-11-25 02:02:41 +01:00
Braulio Valdivielso Martínez 4c82dbab6f Fix 'Transfer-Encoding: chunked' change 2015-11-24 13:42:13 +01:00
Braulio Valdivielso Martínez 6f6b2fd1d5 Set 'Transfer-Encoding: chunked' if data file length equals 0 2015-11-23 20:52:06 +01:00
Ian Cordasco 5397ef71b3 Fix super_len for partially read files
Closes #2872
2015-11-10 21:22:24 -06:00
vienno d849d6e907 Replace 'if x' with 'if x is not None' in cookie loop 2015-11-10 13:58:09 +01:00
vienno 89178ebcdc Complete unnesting of if statements in cookie loop 2015-11-10 13:47:40 +01:00
vienno a25a641fb4 unnest deep loop 2015-11-10 12:36:36 +01:00
Ian Cordasco 35170e180e Merge pull request #2858 from Lukasa/support_ca_cert_directories
Add support for a directory of CAs
2015-11-07 15:39:41 -06:00
Ian Cordasco 7d5d067e9c Merge pull request #2861 from Lukasa/broken_chunked_encoding
Fix breakage introduced by 8f591682
2015-11-07 11:50:50 -06:00
Artur Siekielski 1ced0040bd Assure session is closed on exception. 2015-11-06 21:54:43 +01:00
Cory Benfield e67cd15bc8 Fix breakage introduced by 8f591682 2015-11-05 18:54:40 +00:00
Cory Benfield 0352ec0bd3 Add support for a directory of CAs 2015-11-05 13:21:21 +00:00
Ann Paul 7dd94941c8 Add 511 Network Authentication Required status code to dict of status codes 2015-10-26 08:42:37 -07:00
Ian Cordasco d290a9b4c6 Merge pull request #2825 from Lukasa/universal_newlines
Add warnings about text/binary mode files.
2015-10-24 09:37:16 -05:00