Commit Graph

133 Commits

Author SHA1 Message Date
kennethreitz fb01456061 Merge pull request #3429 from nateprewitt/docstring_cleanup
Docstring cleanup
2016-07-20 18:38:38 -04:00
Nate Prewitt b7809acb47 making class and function docstrings consistent 2016-07-20 11:43:47 -06:00
Nate Prewitt 2d4a89f5dc adding in pep8 fixes 2016-07-20 10:30:08 -06:00
Nate Prewitt d262df99bf removing redundant test 2016-07-14 21:53:10 -06:00
Nate Prewitt be31a90906 Defining header value type requirements and tests 2016-07-05 17:32:05 -06:00
Andrii Kostenko 7700ecae14 Support responses like HTTP/1.1 404 Unicode chars (#3385) 2016-07-05 09:01:19 -05:00
Cory Benfield bd9e8f2271 Merge pull request #3366 from nateprewitt/2947-no-returns-in-header
check for headers containing return characters
2016-07-02 20:32:17 +01:00
Nate Prewitt 2669ab797c check and test for headers containing return characters or leading whitespace 2016-07-02 13:10:47 -06:00
Joy Zheng 0bcf634135 Allow None value for chunk_size again (#3368) 2016-06-30 19:11:01 -05:00
Nate Prewitt 92fe51c0af adding asserted_encoding check on None type encoding to match text() behavior (#3362) 2016-06-28 14:22:00 -05:00
Nate Prewitt cf3c99890d added in type check for chunk_size 2016-06-27 19:58:15 -06:00
kennethreitz 771ecd7efd Merge pull request #3236 from eriol/xfail-test
Use xfail marker for a test expected to fail without Internet connection
2016-06-20 22:17:23 -04:00
John Vandenberg 400d27f982 Test security warnings (#3289)
Verify that the expected warnings are emitted
with SubjectAltNameWarning emitted on all environments
due to the https server provided by httpbin_secure.
2016-06-17 08:00:05 -05:00
Daniele Tricoli 5e86103387 Use xfail marker for a test expected to fail without Internet connection
This is only a minor improvement on the great work of
https://github.com/kennethreitz/requests/pull/2859 that permits to run
tests on hosts without Internet connection.
2016-05-29 20:47:41 +02:00
Cory Benfield 49b69c4751 Merge pull request #3178 from haikuginger/master
Encoding JSON requests to bytes for urllib3 to handle
2016-05-22 17:02:09 +01:00
Brett Higgins 4bf8866172 Add 'all' proxy selection to select_proxy
It seems it's necessary both in pulling all_proxy from the environment
(rebuild_proxies) and deciding which proxy to use (select_proxy).

Also added new functional test.
2016-05-13 15:30:38 -04:00
Brett Higgins 1121f8b915 Support ALL_PROXY environment variable
Closes #3183.
2016-05-11 10:37:53 -04: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
Jesse Shapiro 04bb965c87 Fixing test; it was accomplishing the right thing, but doing it in the wrong way. 2016-05-05 12:23:59 -04:00
Jesse Shapiro 386382b18c Encoding JSON requests to bytes for urllib3 to handle; ensuring same with testing. 2016-05-04 20:09:07 -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
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
Piotr Jurkiewicz b1a7dcd799 Fix test_headers_preserve_order 2016-04-16 22:21:10 +02: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 4f5741e1ff Add test of headers order preservation 2016-04-15 00:35:57 +02:00
tzickel 219490ea7f Make a dummy test 2016-04-08 23:17:37 +03:00
tzickel 2246a52a36 Added a test to show a faulty behaviour when posting binary data for an object
with no __iter__
2016-04-08 20:25:01 +03: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
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
Casey Davidson f74a6707af Verify that cookie can be properly accessed if domain is specified, and that error is raised otherwise. Refs #3028. 2016-03-05 20:37:56 -08:00
Casey Davidson c53a685e7d Fix typo. 2016-03-05 20:30:36 -08:00
Casey Davidson b9517a58bc Assert that both cookies were added in test. Refs #3028. 2016-03-04 15:59:13 -08:00
Casey Davidson 1185d65202 Add tests to specify when CookieConflicError should be raised. References #3028. 2016-03-04 15:55:43 -08:00
kennethreitz bbadf47a8f syntax changes 2016-02-05 15:53:59 -05:00
Dmitry Dygalo 18b26d20f7 Added tests module. 2016-02-05 13:21:57 +01:00
Kenneth Reitz e4c4c80b82 remove all old tests 2012-12-17 07:27:25 -05:00
Kenneth Reitz 79992579c9 remove danger_mode tests 2012-12-14 23:27:38 -05:00
Kenneth Reitz 67c7e496f5 remove safe_mode tests 2012-12-14 23:26:48 -05:00
Kenneth Reitz d36ceb9d06 Merge pull request #953 from heyman/fix_session_safe_mode
Fixes so that safe_mode works for Sessions
2012-11-26 00:31:45 -08:00
Cory Benfield d5f9a2a51c Avoid using callable().
Callable() is not included in Python 3.1, so we shouldn't use it.
2012-11-24 12:15:30 +00:00
Jonatan Heyman 8269ee7266 Fixed so that safe_mode works for Sessions 2012-11-23 16:48:51 +01:00
Russell Davis ccf4ca8929 Fix a bug in _encode_params - it wasn't utf-8 encoding strings in values that
are iterable but not a list.
2012-11-03 12:58:04 -07:00
Radu Voicilas ce7c86cc58 Replace assert statements with unittest's self.assert*
-- the incetive for this being that with self.assertEqual you get an
error message if the test fails
2012-10-18 22:24:59 +03:00
Kenneth Reitz aa08f33f98 Merge pull request #884 from everbird/develop
Support CJK parameters when post files
2012-10-17 07:21:39 -07:00
Stephen Zhuang bb9e72885a For the uniformity :) 2012-10-09 23:19:42 +08:00
Radu Voicilas 820dfb0495 Making the code more PEP8 compliant 2012-10-09 00:42:49 +03:00
Ian Cordasco 4e6cf21d82 Only register callable items in lists
Prior to this, you could sneak a list of anything to register_hook and it
would accept it. This will check if the items in the list are callable before
registering them. Also added a regression test to make sure if this gets
changed it will be noticed.
2012-10-09 00:42:49 +03:00
Stephen Zhuang 86b39bf3e3 Support CJK parameters when post files 2012-10-08 16:52:06 +08:00