Commit Graph

1974 Commits

Author SHA1 Message Date
Kumar Varadarajulu 17b6c5742c consider plain ip notation of an ip in no_proxy if not in cidr notation 2016-05-16 06:11:25 +00:00
Cory Benfield 0838685dab Replace tab with appropriate spaces. 2016-05-12 10:57:52 +01:00
messense cb4c2c0b65 Fix TypeError when get json-encoded content of a response
``self.content`` could be ``None``, so ``len(self.content)`` may raise ``TypeError: object of type 'NoneType' has no len()``
2016-05-06 09:53:14 +08:00
kennethreitz f69d8c16ed updated urllib3 (v1.15.1) 2016-04-29 18:11:17 -04:00
kennethreitz a5da4f399f v2.10.0 2016-04-29 18:03:28 -04:00
kennethreitz 39d6935488 Merge pull request #2953 from Lukasa/socks_proxy_support
SOCKS Proxy Support
2016-04-29 18:03:04 -04:00
kennethreitz c9ef5653cc v2.9.2 2016-04-29 17:56:42 -04:00
kennethreitz ce5e312593 Merge pull request #3096 from piotrjurkiewicz/master
Change _store of CaseInsensitiveDict to OrderedDict
2016-04-29 17:47:35 -04:00
Mark Shannon abe02ed89f Initialize hash_utf8 to None, preventing NameError. Fixes #3138. 2016-04-29 16:49:24 +01:00
Rémy HUBSCHER 70a344d8eb Update readthedocs links. 2016-04-28 12:39:10 +02:00
John R. Lenton 4e7beef860 utils: let select_proxy not raise an exception when url has no hostname 2016-04-26 11:22:44 +01:00
Kevin Burke ae1ac2d4e0 Flip conditional in session.send()
Previously we checked that the `request` being sent was an instance of a
PreparedRequest. If a user somehow created a PreparedRequest using a different
Requests library instance, this check makes the request un-sendable.

(This happened recently - unbeknownst to me, my server was running an outdated
version of pip, vulnerable to this issue - pypa/pip#1489, which creates
multiple subdirectories (src/requests, src/requests/requests) when you rerun
pip install --target. So the PreparedRequest was being created in one version
of the library and compared against the other version of the library, and
throwing this exception, even though they were both PreparedRequest instances!)

It would probably be preferable to check the object's behavior (instead of
its type), but a PreparedRequest has a lot of behavior, and it wouldn't be
really feasible or allow us to provide a helpful error message to check all
of it here. Instead flip the conditional to guard against the user sending an
unprepared Request, which should still give us most of the benefits of the
better error message.

Fixes #3102
2016-04-21 08:12:05 -07:00
Matt Dainty 2029a8a931 Clear any pooled proxy connections
As well as clearing any pooled direct connections, iterate over any
ProxyManager objects and clear any pooled proxy connections there as well.
2016-04-15 09:33:37 +01:00
Piotr Jurkiewicz c8a0fc6aa2 Use OrderedDict from .compat module 2016-04-15 04:43:53 +02:00
Piotr Jurkiewicz 4c04469cfb Change _store of CaseInsensitiveDict to OrderedDict 2016-04-14 18:10:50 +02:00
Ian Cordasco e65d6fc637 Merge pull request #3082 from tzickel/master
Added a test to show a faulty behaviour when posting binary data for an object with no __iter__
2016-04-11 07:38:50 -05:00
liuyang 2981366f56 add rtype in session.request 2016-04-11 14:33:23 +08:00
tzickel fb230709a8 Fix for the test ? 2016-04-08 22:23:35 +03:00
Cory Benfield 831d8e0a1e Add 421 Misdirected Request. 2016-04-08 08:23:46 +01:00
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 e4d15c4649 Help @sigmavirus24 with code golf. 2015-12-30 16:45:51 +00:00
Cory Benfield 11b9b24ac9 Some code cleanups. 2015-12-30 14:37:53 +00:00
Cory Benfield 1c54014daf Don't parse nonexistent URLs. 2015-12-30 10:48:29 +00:00
Cory Benfield 39ee5d46dc Silence SOCKS dependency warning on import 2015-12-30 10:40:30 +00:00
Cory Benfield 08364c6739 Add support for SOCKS 2015-12-30 10:40:24 +00:00
Cory Benfield 396963ac7e Temporary urllib3 patch 2015-12-30 10:40:12 +00:00
Cory Benfield cd84b3ff94 Update to urllib3 1.14 2015-12-30 10:07:16 +00: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