David Black
71a05cf289
Avoid an unnecessary computation of the length of data for non-stream requests (which determines content-length based upon body content).
2020-06-16 20:53:07 +10:00
Thomas Grainger
9ed5db8ed2
fix raise_for_status docstring ( #5293 )
...
the exception isn't stored it's created new each call
2020-05-08 22:08:51 -07:00
Nate Prewitt
fd13816d01
Revert "Fix for response with UTF-8 BOM #4976 "
...
This reverts commit 19cff44ec1 .
This reverts commit 9e27326d68 .
This reverts commit f507a3ef12 .
2020-02-18 18:56:39 -06:00
Nate Prewitt
b15056d1d3
Revert " #4965 fix: Accessing response.content twice removes forgets read error."
...
This reverts commit bd10047244 .
This reverts commit d91fe00983 .
2020-02-18 18:56:39 -06:00
kennethreitz
428f7a2759
Merge pull request #5076 from myrheimb/patch-1
...
Possible fix for #4945 ?
2019-08-20 00:38:21 -04:00
kennethreitz
4bce5a0bc5
Merge branch 'master' into feature/strip-utf8-bom
2019-08-20 00:26:51 -04:00
kennethreitz
df918c066f
Merge branch 'master' into master
2019-08-20 00:25:37 -04:00
kennethreitz
67a7b2e833
Merge pull request #5087 from LuckyDenis/master
...
#4965 Fix
2019-08-20 00:16:35 -04:00
Nihaal
9cdf294107
Updated references to previous requests/requests GitHub path
2019-08-19 21:33:18 +01:00
Белавин Денис
bd10047244
#4965 fix: Accessing response.content twice removes forgets read error.
2019-05-14 12:11:56 +03:00
Белавин Денис
d91fe00983
#4965 fix-draw: Accessing response.content twice removes forgets read error.
2019-05-13 17:18:42 +03:00
Bjørnar Myrheim
a310b5ab34
Possible fix for #4945 ?
...
Could the missing colon on line 612 be the reason for the missing reference in the docs as described in issue #4945 ?
2019-04-30 18:37:11 +02:00
aless10
177f4dd2a4
[fix] fix failing doctests in requests/*
...
[add] add --doctest-modules in pytest.ini file as addopts
[add] add myself to AUTHORS
2019-02-17 19:06:01 +01:00
Eduardo Rodrigues
19cff44ec1
fix response with utf8 bom
2019-02-09 22:14:22 +01:00
Kyle Altendorf
a7aa86a933
Set iter_lines() decode_unicode default to False
...
The docs just read a bit strange with `decode_unicode=None` as opposed to `False`.
2018-11-06 12:35:39 -05:00
Hugo Osvaldo Barrera
89ab030cdb
Use comprehensions whenever possible
2018-10-16 20:34:22 -07:00
Jon Dufresne
b0ad2499c8
Prefer https:// for URLs throughout project
2018-09-30 17:14:40 -05:00
Matthieu Moy
c008bf3883
Document that 'params' can also be a list of tuples
...
Like we just did for 'data', 'params' follows the same processing and
can also be a list of tuples.
2018-07-17 18:55:55 +02:00
Matthieu Moy
2d1b4482c5
Document that 'data' can be a list of tuples everywhere
...
The documentation for the 'data' parameter of various functions was
inconsistant. The low-level function, used by every convenience API,
internally uses RequestEncodingMixin._encode_params which accepts list
of tuples as well as dictionaries, hence every function taking a data
parameter also accepts a list of tuple.
Keep the documentation short, but provide a link to Request for
details.
2018-07-17 18:45:43 +02:00
Raymond Hettinger
7e297ed95b
Separate collections from collections.abc
2018-06-11 22:14:59 -07:00
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