Ofek Lev
c1b828bc95
Response.content minor perf improvement
2018-05-26 18:20:27 -04:00
Rajiv Mayani
8546a15587
The library raises NoneType error when file-pointer (fp) resolves to None.
...
>>> from requests import post
>>> r = post("https://example.com ", files={"file-name": None})
However, when a param value or json field is None they are not included in the request body.
>>> from requests import get
>>> r = get("https://example.com ", params={"file-name": None})
>>> r.request.url
This commit makes the beahviour consistent for files.
2018-05-17 13:56:17 -07:00
Alex Chan
775cde0914
Clarify that Response.ok will *only* return True/False
2017-11-20 09:16:35 +00:00
Mark Szymanski
e2f5a135c3
remove legacy super() call
2017-07-26 19:21:45 -05:00
Ed Morley
4847f5b8cd
Allow Requests.Response to be used as a context manager
...
This saves having to wrap the call to requests with
`contextlib.closing()`, allowing it to be used directly in a
`with` statement, like so:
```
with requests.get('http://httpbin.org/get ', stream=True) as r:
# Do things with the response here.
```
Fixes #4136 .
2017-06-06 23:30:47 +01:00
kennethreitz
33619268f9
cleanup models.py
2017-05-29 23:00:09 -04:00
kennethreitz
7f14db17c8
new requests namespace
2017-05-29 12:11:43 -04:00
kennethreitz
6d3d5e59c9
fix models.py
2017-05-26 22:55:55 -04:00
kennethreitz
6c41633cfd
fix models.py
2017-05-26 22:50:13 -04:00
kennethreitz
c3367d1854
remove Request.send(session)
2017-05-26 21:28:52 -04:00
kennethreitz
dfd667df96
who wrote this shit
2017-05-26 21:17:13 -04:00
kennethreitz
ce64cce14e
API improvements
2017-05-26 21:07:37 -04:00
Chris Gavin
19ba9f1097
Remove some unused imports.
2017-04-25 22:10:01 +01:00
Ruben Dura Tari
ead8fba84b
Fixes DeprecationWarnings in Python 3.6 due to invalid escape sequences. Fixes #3954
2017-04-05 15:51:58 +01:00
Ian Cordasco
8e049bd9eb
Update docstrings for Response.__{bool,nonzero}__
...
Like the docstring added to Response.ok these were misleading and
vaguely incorrect. Better to be explicit than implicit.
2017-02-16 07:21:15 -06:00
Ian Cordasco
7a281e74ec
Correct docstring for Response.ok
2017-02-16 07:15:37 -06:00
Mislav Cimperšak
3664682539
added docstring for response.ok property
2017-02-16 10:06:28 +01:00
Moin
fae3f92c34
lazily load idna library
2017-01-17 20:34:15 +05:30
Cory Benfield
402a55b647
Revert "Restrict URL preparation to HTTP/HTTPS"
...
This reverts commit 34af72c87d .
2016-11-30 21:19:31 +00:00
Cory Benfield
5c4549493b
Merge pull request #3695 from nateprewitt/idna_bypass
...
idna bypass
2016-11-25 13:18:01 +00:00
Nicola Soranzo
f897be58bf
Make Response.content return None if raw is None
...
Add test.
2016-11-24 12:54:26 +00:00
Nicola Soranzo
4f428228d7
Make Response.content() return None if status_code is None
...
Fix #3698 .
2016-11-23 21:15:07 +00:00
Christian Heimes
34af72c87d
Restrict URL preparation to HTTP/HTTPS
...
Requests treats all URLs starting with the string 'http' as HTTP URLs.
Preparation with IDNA breaks non-standard URIs like http+unix. Requests
now prepares only URLs with prefix http:// and https://.
Signed-off-by: Christian Heimes <christian@python.org >
2016-11-21 18:46:57 +01:00
Nate Prewitt
a83685ce00
modifying IDNA encoding check to allow fallback
2016-11-21 08:22:42 -07:00
Hussain
0d7de50dbd
Just lstrip instead of strip because trailing whitespace already works.
2016-11-16 23:26:48 +05:30
Hussain
248d3e9f0f
Fixed issue #3696 . Added a test for it as well.
2016-11-16 22:48:45 +05:30
Chris Martin
a49c387b7a
Document that Response.json() may raise ValueError
2016-11-10 16:26:07 -05:00
Nate Prewitt
40402cd0dd
adding rewind for re-POST bodies
2016-11-02 09:56:56 -06:00
Philipp Konrad
548a03acef
requests.post checked data parameters for type like dict.
...
Changed the type check to Mapping.
2016-10-27 17:57:09 +02:00
Cory Benfield
8dd51d22fc
Enable UTS46 mode.
2016-10-14 15:13:37 +01:00
Cory Benfield
27812eb902
Use IDNA2008 to encode hosts.
2016-10-14 10:17:52 +01:00
Frankie Robertson
327512f5ef
Remove error swallowing exception catching of AttributeError
2016-09-29 23:07:16 +09:00
Brian Bamsch
087aeacee5
Change module of internal references to to_native_str()
2016-09-27 20:41:21 -07:00
Nate Prewitt
31b35ab838
removing redundant logic from prepare_content_length
2016-09-21 16:37:28 -06:00
Carson Lam
d7227fbb7e
Add workaround to avoid implicit import of encodings.idna.
2016-09-17 00:12:36 -07: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
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