Commit Graph

634 Commits

Author SHA1 Message Date
Ian Cordasco bbbd9de6fd Merge pull request #2472 from scholer/master
Avoid data duplication when creating a Request with str/bytes/bytearray input
2015-03-14 07:43:17 -05:00
Priit Laes 4497a26c37 Document Response.iter_lines() reentrancy issues 2015-03-07 12:00:41 +02:00
Rasmus Scholer (TimelineX) ec700a9a13 Avoid duplicating files data when creating a Request with str/bytes/bytearray in the files argument. 30-40% performance improvement. 2015-03-04 10:21:38 -05:00
Rasmus Scholer (TimelineX) 11b12c3e07 models.RequestEncodingMixin._encode_files now takes bytearray as fp in addition to the currently supported bytes and str input. 2015-03-03 02:44:52 +01:00
Ian Cordasco bd3cf95e34 Fix error handling on Python 3 2014-12-16 22:49:24 -06:00
Ian Cordasco 386c589ba0 Merge branch 'master' of https://github.com/ContinuousFunction/requests into pr/2344 2014-12-16 22:18:51 -06:00
daftshady 925e975295 catch exception more specifically in Response.ok 2014-12-16 16:55:13 +09: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
Alexander Nelzin ee50afef59 Fixed. 2014-11-12 15:35:27 +03:00
Val Tenyotkin 3602690886 Changing parameter name newline ==> delimiter. 2014-10-24 16:37:35 -07:00
Val Tenyotkin f5ff05be1e Adding a custom line delimiter to iter_lines() 2014-10-21 18:03:11 -07:00
kennethreitz 6da438dabd Merge pull request #2268 from sigmavirus24/fix-params
Re-order params for backwards compat
2014-10-06 05:40:03 -04:00
Ian Cordasco 0e4efab270 Re-order params for backwards compat 2014-10-05 18:55:59 -05: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 65cdccb70f Merge pull request #2241 from tijko/master
raise RuntimeError when a single streamed request calls *iter methods th...
2014-10-05 12:48:40 -04:00
kennethreitz 1e79cf6a47 Merge pull request #2258 from willingc/add-json
Add json parameter
2014-10-05 12:46:09 -04:00
Ian Cordasco 8ed941fa69 Fix a couple of issues I noticed
- Don't _ prefix json in prepare_body
- Don't initialize json to []
- Don't initialize json to {}
- Reorder parameters to PreparedRequest.prepare
- Remove extra parentheses
- Update docstring
2014-09-30 16:03:31 -05:00
Joe Alcorn a68d1b4517 Support bytestring URLs on Python 3.x 2014-09-30 19:29:10 +01:00
Tim Konick 6e5f7bb9d3 using the StreamConsumedError 2014-09-22 15:51:59 -04:00
Tim Konick d6470870d0 rm else after if then raise block 2014-09-22 12:46:07 -04:00
Tim Konick fdf932c61c raise RuntimeError when a single streamed request calls *iter methods than once 2014-09-22 12:04:29 -04:00
Daniel Hahler bff8b91638 Document skipping in PreparedRequest; followup to #2222 2014-09-12 18:07:28 +02:00
Carol Willing 402f3b4993 Changes check on base and json. Fails on tests. 2014-08-28 19:27:45 -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
Josh Schneier 47d0517d66 handle urllib3 api changes; closes #2045 2014-07-29 23:29:21 -04:00
Roman Levin 9eab9f7415 Handle socket errors in iter_content 2014-07-24 23:00:50 +02:00
Eric L Frederich c3444f8c7a don't make duplicate requests for permanent redirects 2014-06-12 08:25:21 -04:00
Eric L Frederich ec3a2e6f04 rename resume/resume_incomplete to permanent_redirect according to rfc7238
Use temporary_redirect intead of temporary_moved to make the words
line up nicely ;-)
2014-06-11 11:08:10 -04:00
Eric L Frederich 07d9b730b7 handle 308 redirection the same as 301 and 302 2014-06-10 16:30:17 -04:00
David Gouldin 32f600b083 Allow copying of PreparedRequests without headers/cookies 2014-05-30 10:11:53 -07:00
Ian Cordasco 5ab79e2514 Remove unnecessary check for builtin_str 2014-05-28 08:17:18 -05:00
Ian Cordasco 3faff0b8ea Check for basestring, not just str
Fixes #2071
2014-05-27 20:29:44 -05:00
Cory Benfield 3346ad1134 Document and initialise Response.request 2014-05-26 16:40:45 +01: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
Cory Benfield 142b26ea7b Clearer description of Response.close(). 2014-04-28 19:42:30 +01:00
Feng Liu 24819e8aae support request tuple data
rewrite the TestModels

Ajust the code
2014-03-27 10:41:49 +08:00
Cory Benfield ee7fe02953 Ensure that .raw() is present after unpickling.
Some people will assume that .raw() is present, and they shouldn't get
AttributeErrors when they make that assumption on a pickled Response.
However, @kennethreitz has asked that we not be too dependent on
urllib3. For that reason, set to None.
2014-03-12 18:34:43 +00:00
Jason R. Coombs d289eb22f1 Always honor decode_unicode, even when _content is present.
--HG--
extra : amend_source : 25977a1227b163d49bf2e1aec6aa448e5cd3be8a
2014-03-04 16:33:40 -05:00
Jason R. Coombs c8226f69e1 Add documentation about decode_unicode. 2014-03-04 16:27:13 -05:00
Zack Weinberg 0caa243212 New Response property, .is_redirect. 2014-02-13 14:27:42 -05:00
kennethreitz 1371e81944 Merge pull request #1900 from mjpieters/issue1674-json-fallback-encoding
Reinstate falling back to self.text for JSON responses
2014-02-11 11:55:20 -05:00
kennethreitz a44910b837 Merge pull request #1902 from mjpieters/master
Remove unused loggers.
2014-02-06 18:32:41 -08:00
Martijn Pieters 3443c177a3 Document the Response.reason attribute.
Made `.status_code` and `.reason` consistent with one another, adding some examples. Addresses #1225.
2014-02-05 17:29:09 +00:00
Martijn Pieters 488b90f5ac Remove unused loggers. 2014-02-03 13:43:59 +00:00
Martijn Pieters c5b6a107eb One last Charade reference to remove here. 2014-02-03 13:39:21 +00:00
Martijn Pieters f35838beb6 Remove logging and charade mention.
Logging is Not Allowed, so out it goes.
2014-02-03 13:37:57 +00:00
Martijn Pieters 5ee8b348eb Reinstate falling back to self.text for JSON responses
A JSON response that has no encoding specified will be decoded with a detected UTF codec (compliant with the JSON RFC), but if that fails, we guessed wrong and need to fall back to charade character detection (via `self.text`). Kenneth removed this functionality (by accident?) in 1451ba0c6d, this reinstates it again and adds a log warning.

Fixes #1674
2014-02-03 12:00:14 +00:00
Kenneth Reitz c6084704cc what is wrong with you people? :) 2014-01-31 12:31:11 -05:00