Commit Graph

345 Commits

Author SHA1 Message Date
colin fd31453aa2 fix unittest typo 2015-05-26 20:53:31 +01:00
colin 1da62a65d9 fix contextlib.closing bug for sessions where content is not consumed (issue #2593) 2015-05-24 15:01:34 -04:00
Ian Cordasco 35045e851a Simplify PreparedRequest.prepare API
Do not require that hooks be passed as an empty list to
PreparedRequest.prepare. In the event hooks is None in prepare or
prepare_hooks, use an empty list as a default.

Related to #2552
2015-04-20 20:13:58 -05:00
Priit Laes 62200cb07e Add testcase to demonstrate r.iter_lines() reentrancy issue 2015-03-07 12:00:37 +02:00
Ian Cordasco 39e49e5fb9 Merge pull request #2466 from sigmavirus24/bug/2465
Only add VendorAliases for vendored dependencies
2015-03-04 07:49:12 -06:00
Rasmus Scholer (TimelineX) 1887f32b17 test_can_send_bytes_bytearray_objects_with_files test now uses string input, not float. 2015-03-03 14:37:39 -05:00
Rasmus Scholer (TimelineX) 326f77d57c Created test case for using bytes and bytearray objects with files argument to Request. 2015-03-03 03:41:00 +01:00
Ian Cordasco 9d8a57f2a2 Add a test to ensure the alias does not regress 2015-02-28 20:19:13 -06:00
Colin Dickson 80aee7a225 add a timeout value to connection_error_invalid_port test to accelerate failure 2015-02-04 21:05:03 -05:00
Colin Dickson ced6550a25 split test_connection_error into two distinct tests, and changed "unknown url" test URL since fooobarbangbazbing.httpbin.org currently gives a valid response. 2015-02-03 21:23:07 -05:00
kennethreitz b137472936 Merge pull request #2393 from sigmavirus24/bug/2356
Attempt to quote anyway if unquoting fails
2015-01-27 10:24:34 -08:00
Ian Cordasco eec44dbbb1 Check that a filename is a basestring instance
Instead of only checking one or another type of string-like object that
we accept, let's be able to check both. Previously, we only checked if
the filename was an instance of the native str type which on Python 2
excluded unicode filenames and bytes-like filenames on Python 3.

Fixes #2411
2015-01-20 20:44:52 -06:00
Ian Cordasco 751b35c346 Attempt to quote anyway if unquoting fails
Fixes #2356
2015-01-18 21:07:43 -06:00
ContinuousFunction 4c61fef13f Uncommented test in test_requests.py
Uncommented test_sesion_pickling in test_requests.py and ran the file to
make sure the test passes.
2014-12-15 13:41:10 -05:00
ContinuousFunction 39090cfba6 Merge branch 'master' of https://github.com/kennethreitz/requests 2014-12-15 13:24:06 -05:00
Arthur Darcet e8d02ea0bb utils.guess_filename fails if the given parameter looks like a file object but has a non-string name attribute
e.g. a cherrypy uploaded file behave like a regular file, except that its name attribute is an int and passing it directly to requests fails because of that
2014-12-12 17:32:43 +01:00
Ian Cordasco cf82d4406b Update tests to work offline 2014-12-01 16:21:41 -06:00
ContinuousFunction 3246b1fe17 Changed ConnectionError to InvalidURL 2014-11-17 20:06:24 -08:00
ContinuousFunction 087a27aba9 Partially addresses Issue #1572
Addresses the LocationParseError but not the DecodeError from
kennethreitz#1572. When running
test_requests.py, I got an error in test_session_pickling which resulted
in a TypeError. I'm not sure of the reason for the TypeError but I have
commented out that test.
2014-11-15 16:58:25 -08:00
Ian Cordasco 2eb7e3c80b Add last few changes and add a quick test 2014-11-12 13:56:28 -06:00
Alexander Nelzin 34f6088c8f Added test for overriding Content-Length. 2014-11-12 15:23:23 +03:00
Ian Cordasco 29ef108158 Use to_native_string instead of builtin_str
Fixes #2316
2014-10-31 21:20:04 -05:00
Scott Sadler 583859b820 fix failing test "test_prepare_unicode_url" \(take 3\) 2014-10-26 14:45:12 +01:00
MinRK ca2ebc5b68 allow unicode URLs on Python 2
on Python 2 u'é'.decode('utf8') fails with UnicodeEncodeError,
but only AttributeError is caught.

This only calls decode on known bytes objects.
2014-10-05 16:30:11 -07:00
kennethreitz 1e79cf6a47 Merge pull request #2258 from willingc/add-json
Add json parameter
2014-10-05 12:46:09 -04:00
Joe Alcorn a68d1b4517 Support bytestring URLs on Python 3.x 2014-09-30 19:29:10 +01:00
Daniel Hahler bff8b91638 Document skipping in PreparedRequest; followup to #2222 2014-09-12 18:07:28 +02:00
Daniel Hahler d3566ee1b0 Add more tests to test_invalid_url
This adds tests for the behavior introduced in b149be5d, where
`PreparedRequest` was made to skip `parse_url` for e.g.
`localhost:3128/`.
2014-09-12 16:11:30 +02:00
Ian Cordasco ce7957c085 Add test for invalid port 2014-08-29 16:50:45 -05:00
Kevin Burke 2c76122a48 Add test that invalid domain raises a ConnectionError 2014-08-29 14:07:28 -07:00
Carol Willing 0713e09526 Fixes typo in test 2014-08-28 19:42:21 -07:00
Carol Willing b34a496649 Adds review changes 2014-08-28 16:45:24 -07:00
Carol Willing 8f17741849 Adds json parameter for POST requests 2014-08-28 12:53:19 -07:00
Kevin Burke 7f236fcc40 woops 2014-08-24 20:22:55 -07:00
Kevin Burke 39b3a436d3 assert connect timeout inheritance 2014-08-24 20:18:05 -07:00
Kevin Burke c2aeaa3959 Add support for connect timeouts
Modifies the timeout interface to also accept a tuple (connect, read) which
would be used to set individual connect and read timeouts for Requests. Adds
Advanced documentation explaining the interface and providing guidance for
timeout values.
2014-08-23 15:12:29 -07:00
ContinuousFunction 2fc6e8a894 Update on Tracking Previous Requests
Modified the comment in sessions.py and rewrote the test in
test_requests.py
2014-08-19 10:51:26 -07:00
ContinuousFunction df641e74ff Tracking Previous Requests
Addresses the issue brought up here:
https://github.com/kennethreitz/requests/issues/1929
2014-08-17 19:13:26 -07:00
Josh Schneier 47d0517d66 handle urllib3 api changes; closes #2045 2014-07-29 23:29:21 -04:00
Roman Levin cf01a743af Replace setattr 2014-07-24 23:30:11 +02:00
Roman Levin 9eab9f7415 Handle socket errors in iter_content 2014-07-24 23:00:50 +02:00
Jeff Knupp bff65f42ee Update with style considerations by @kennethreitz 2014-06-10 11:16:24 -04:00
Jeff Knupp e2c4da7dd2 various pep-8 cleanups; remove unsused imports; remove unused variables 2014-06-10 09:09:33 -04:00
Cory Benfield d977ee8a24 Force basic auth strings to native string type 2014-06-08 10:20:32 +01:00
David Gouldin 32f600b083 Allow copying of PreparedRequests without headers/cookies 2014-05-30 10:11:53 -07:00
Martin Geisler c8916a08de test: restore Python 3.2 compatibility
The tests were broken because they used the u'...' Unicode literal
syntax which disappeared in Python 3.0 to 3.2.

We can work around this by conditionally defining a "u" function which
will produce a Unicode literal on Python 2.x. This is basically the
same approach as taken by the six library often used for writing
cross-version compatible code.
2014-05-26 16:20:39 +02:00
schlamar 16459910a9 Added test for redirect with wrong gzipped header. 2014-05-12 22:45:45 +02:00
schlamar 5e860c08d8 Added test case to handle response of streamed redirects.
Credits go to @zackw.
2014-05-12 22:45:45 +02:00
kennethreitz 569cd23c00 Merge pull request #1937 from jaraco/master
Improved decoding support for Response.iter_content and iter_lines
2014-05-12 15:04:35 -04:00
Feng Liu 24819e8aae support request tuple data
rewrite the TestModels

Ajust the code
2014-03-27 10:41:49 +08:00