Commit Graph

702 Commits

Author SHA1 Message Date
Michael Hunsinger 713f56ea53 Decode response requires encoding to be set 2016-09-14 20:58:36 -06:00
Ian Cordasco b2f6173a38 Merge remote-tracking branch 'upstream/master' into proposed/3.0.0
Conflicts:
   requests/__init__.py
   requests/sessions.py
   tests/test_requests.py
2016-09-06 09:46:02 -05:00
Nate Prewitt 2e1086f5b4 adding comment 2016-09-05 14:17:46 -06:00
Nate Prewitt cd056cd621 adding ISO-8859-1 fallback for reason decoding 2016-09-02 11:37:48 -06:00
Nate Prewitt 59f12c9669 adding passthrough in close() for non-urllib3-like Responses 2016-08-12 10:54:41 -06:00
Ian Cordasco c69e3eed31 Close and then release the connection
urllib3 closes the underlying connection when we call
urllib3.Response.close but does not release it back to the connection
pool. This can cause issues when users have a blocking connection pool
configured and connections are not readily returned to the pool.

Since the underlying connection is closed, we should be able to safely
return the connection to the connection pool, so to fix this issue we
merely need to not return after closing the response.

Closes gh-3461
2016-07-30 07:16:18 -05:00
Ville Skyttä 5453b88f8f Spelling fixes 2016-07-26 15:24:29 +03:00
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
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
Nate Prewitt 0c08ca7154 updating docstring to match functionality 2016-07-02 08:43:23 -06:00
Joy Zheng 0bcf634135 Allow None value for chunk_size again (#3368) 2016-06-30 19:11:01 -05:00
Nate Prewitt cf3c99890d added in type check for chunk_size 2016-06-27 19:58:15 -06:00
Ian Cordasco ecfb85f85e Merge remote-tracking branch 'upstream/master' into proposed/3.0.0
Conflicts:
      AUTHORS.rst
      requests/__init__.py
      requests/sessions.py
      tests/test_requests.py
2016-06-03 08:42:01 -05: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
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 52c0daff5f Cleaning up comment on JSON encoding to be more strictly relevant. 2016-05-05 12:12:49 -04:00
Jesse Shapiro 9ff2e43cd6 Removing charset from JSON content type; tightening requirements on .encode() 2016-05-05 06:27:12 -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
tzickel fb230709a8 Fix for the test ? 2016-04-08 22:23:35 +03: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
Dave Padovano 09ecb718ae remove simplejson 2016-03-16 12:24:50 -04:00
Tomáš Heger 7a2b20cb53 Fix #3017: Whitepace characters surrounding a URL should be ignored 2016-02-18 07:44:21 +01:00
kennethreitz 0e51e48473 PreparedRequest.send() 2016-02-02 02:12:38 -05:00
kennethreitz 0f930d99f2 resolve merge errors causing test failures 2016-02-02 00:10:06 -05:00
kennethreitz a0b7bdd187 Merge commit '1881851' into v3.0.0 2016-02-01 23:57:29 -05:00
kennethreitz 6dff2bb71c Merge commit '8c4d4f1af3a501ae0beec5e270f3206cda5c4842' into v3.0.0 2016-02-01 23:46:26 -05:00
kennethreitz 26cf9abfd6 Merge commit '4aa4f82b37aeb272637fafeff498014af1c11c6b' into v3.0.0 2016-02-01 23:39:17 -05:00
kennethreitz d1871fabe9 Merge commit 'ff8153d9c56bfa62782fb99743219d0b02b512bb' into v3.0.0 2016-02-01 23:28:55 -05:00
kennethreitz 45f110b52d Merge commit '636b946af5eac8ba4cffa63a727523cd8c2c01ab' into v3.0.0 2016-02-01 23:28:26 -05:00
Chad Whitacre f8d2fb83a3 Rename {Missing,Invalid}Schema to *Scheme
Schemes are what they're called, not schemas.

Conflicts:
	requests/models.py
2016-01-05 12:20:20 -05:00
Cory Benfield fc8fa1aa26 Fix regression from #2844 regarding binary bodies. 2015-12-16 14:56:13 +00: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
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
Alex Khomchenko edc68a0ac8 fix issue #2844 2015-10-23 15:22:36 +03:00
Cory Benfield 2df3c7c75d Move to_native_string for methods to prepare() 2015-10-12 10:50:37 +01:00
Cory Benfield 3948a9562d Use general null check for JSON 2015-10-08 14:53:35 +01:00
Cory Benfield f6afa71281 Merge pull request #2763 from ravipra/json_supersedes
Fixed issue #2756
2015-10-05 15:27:53 +01:00
sumitbinnani bf38d5bf52 Update models.py
Updated Documentation:
```data``` as well as ```files``` supersedes json
2015-10-02 13:50:52 +05:30
Ravi Prakash Putchala 7a0cd16c1a changed the null check for 'data' parameter to be more explicit.
removed the superfluous encode from the testcase.
2015-09-09 13:04:24 +05:30
Ravi Prakash Putchala 37037607b5 Fixed issue #2756
Now 'json' parameter will be used to prepare body only if the 'data'
parameter is not present
2015-09-08 14:45:46 +05:30
Marc Abramowitz e3bdec5934 Display URL as part of HTTP error messages
It seems convenient to include the URL in the error message in case you
get an unexpected error.

E.g.:

    In [1]: import requests

    In [2]: resp = requests.get('http://www.google.com/eofdfdfdfdfd')

    In [3]: resp
    Out[3]: <Response [404]>

    In [4]: resp.raise_for_status()
    ---------------------------------------------------------------------------
    HTTPError                                 Traceback (most recent call last)
    <ipython-input-4-00e7077cfb5b> in <module>()
    ----> 1 resp.raise_for_status()

    /Users/marca/dev/git-repos/requests/requests/models.py in raise_for_status(self)
        835
        836         if http_error_msg:
    --> 837             raise HTTPError(http_error_msg, response=self)
        838
        839     def close(self):

    HTTPError: 404 Client Error: Not Found for url: http://www.google.com/eofdfdfdfdfd
2015-06-22 13:22:59 -07:00
Ian Cordasco 8c4d4f1af3 Move handling of method to PreparedRequest 2015-06-02 14:02:46 -05:00
Ian Cordasco 4aa4f82b37 Make the tests pass the method to Request 2015-05-30 09:32:31 -05:00
Cory Benfield ff8153d9c5 Better default for request method 2015-05-28 18:33:24 +01:00