Commit Graph

2249 Commits

Author SHA1 Message Date
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
Ian Stapleton Cordasco 371ee7cbec Merge branch 'master' into master 2018-05-16 08:46:26 -05:00
Julien Prigent 60a5a393d8 Add a comment about lowercase env. variables precedence over uppercase 2018-05-13 06:15:56 -07:00
Elias Obeid 75c57985b0 update json param's description to avoid confusion
- the Request class doesn't accept JSON, but a JSON serializable object
2018-04-30 16:50:23 +02:00
David Poole 85ec7d759e Merge branch 'master' into master 2018-03-05 09:07:12 -07:00
Jon Dufresne 265ef609d5 Remove remaining references to removed, vendored packages (#4499)
As the vendored packages were removing in version 2.16, all remaining
doc references should be replaced with newer practices.
2018-02-17 08:15:54 -06:00
Semen Zhydenko 22120d423e Fix typos
nonexistant -> nonexistent
neccessary -> necessary
2018-02-07 18:25:22 -06:00
Jonathan Elliott Blum 8e040523a4 pass kwargs from send call to add_headers, per documentation 2018-02-02 13:10:16 -05:00
Nate Prewitt f60324a3de append previous url fragment on redirect 2018-01-21 09:55:45 -08:00
Darren Dormer 2255c34a65 Fix DNS resolution by using hostname instead of netloc and strip username and password when comparing against proxy bypass items. 2018-01-16 10:18:06 +01:00
dbairaktaris1 7deee699ad slice function removed 2018-01-04 10:48:17 -06:00
dbairaktaris1 cb0914407b Continue to refactor, remove list comprehension, add double quotes test case. 2018-01-04 10:30:50 -06:00
dbairaktaris1 80a790443e implement changes after code review 2018-01-03 23:41:41 -06:00
dbairaktaris1 071796d83f implement changes after code review 2018-01-03 23:40:08 -06:00
dbairaktaris1 1988d9cf72 Move nested function up to module level and rename. Add more tests for function. 2018-01-01 14:20:55 -06:00
dbairaktaris1 cef0830419 clean 2017-12-31 15:02:39 -06:00
dbairaktaris1 d8666e1906 Reduce overall memory usage of Requests module by removing cgi module dependency in utils.py. Instead wrote a nested function to parse header and return content type and params. 2017-12-31 14:46:15 -06:00
David Poole efacb9e312 Merge branch 'master' into master 2017-11-29 07:13:07 -07:00
Anton Fedchin 714c9dc967 utils: winreg module may not exist like on windows universal platform. 2017-11-25 17:21:59 +03:00
Zane Bitter 19919b44c4 Add documentation for available status codes
There was no way to determine what actual names were available outside
of looking at the source code. They were not listed in the documentation
or accessible through the interactive help.

In addition, doing `pydoc requests.status_codes` displayed some pretty
unhelpful information - the utf-8 encoding string was included in the
module name, there was no description, and internal variables used for
initialisation leaked into the module scope:

    DATA
        code = 511
        codes = <lookup 'status_codes'>
        title = 'network_authentication'
        titles = ('network_authentication_required', 'network_auth', ...

This change prevents the internal variables from leaking, adds a
docstring (which has the side-effect of correcting the module name), and
appends information on the allowed status code names to the docstring
when the module is initialised.

The improved module documentation is then used in the API documentation
to provide another easy reference to the complete list of status codes.
2017-11-21 16:11:34 -05:00
Mingyuan Xia acd2645444 #4373, fix possible winreg value type difference (#4377)
* #4373, fix possible winreg value type difference

* add a test for ProxyOverride and ProxyEnable on win32

* add tests for winreg key ProxyEnable with two possible types

* fixing AppVeyor failures
2017-11-20 20:01:04 +00:00
Alex Chan 775cde0914 Clarify that Response.ok will *only* return True/False 2017-11-20 09:16:35 +00:00
David Poole a31531fb9c Merge branch 'master' into master 2017-11-19 08:45:25 -07:00
Nehal J Wani 9a8a826f22 Check if host is invalid for proxy
According to RFC3986, the authority section can be empty for a given URL,
however, for a proxy URL, it shouldn't be. This patch adds a check to verify
that the parsed URL will have a valid host before creating the proxy manager.

Fixes #4353
2017-11-15 08:58:54 -05:00
David Poole 1dbaddd75e for RFC-7616 add SHA-256 and SHA-512 2017-11-08 18:32:59 -07:00
Arthur Vigil c86b09b3c6 support extraction of certificate bundle from a zip archive 2017-11-05 12:14:17 -08:00
Alvaro Gutierrez Perez 2afc1cb37b Merge branch 'master' into patch-1 2017-10-21 03:24:55 +02:00
INADA Naoki a05aac7007 avoid import platform
platform module is relatively large: it takes about 5ms to import
2017-10-20 02:49:22 +09:00
Alvaro Gutierrez Perez d3f14af44d Fix case-insensitive comparison in get_adapter()
While trying to get the prefix for an url, the url was lowered before comparing but the prefix not, so if it contains non-lowercase characters (eg. https://api.example.com/sOmE_WeiRD_pReFIX/), it won't match.
2017-10-18 19:27:06 +02:00
Hugo ec5804c706 Python 3.3 has already been dropped (#4231) 2017-10-15 20:04:51 +03:00
Taylor Rose 15054aa390 Warn user about possible slowdown when using cryptography version <
1.3.4
2017-10-14 09:00:58 -04:00
Remi Rampin 965ada6f66 Fix parse_header_links on empty header 2017-08-16 22:10:20 -04:00
Cory Benfield a3d7cf3f27 v2.18.4 2017-08-15 14:22:52 +01:00
mgasvoda e36083b89c Adding space after colon 2017-08-11 16:19:43 -04:00
mgasvoda 308343508b Removing trailing whitespace 2017-08-11 16:14:13 -04:00
mgasvoda ba21d14976 Improving message formatting 2017-08-11 16:12:36 -04:00
mgasvoda cee8fae65e Adding header name to exception
Adds the name of the header to the invalid header exception raised on TypeError.
2017-08-11 15:37:57 -04:00
Cory Benfield 7c67c4adf9 v2.18.3 2017-08-02 14:22:44 +01:00
Cory Benfield 4f49f6b3ed Correctly raise SSLError from urllib3. 2017-07-29 12:12:11 +01:00
Alex Chan 39b121d791 Add idna version info to requests.help 2017-07-27 21:33:42 +01:00
Alex Gaynor 2629c0906e Merge branch 'master' into patch-2 2017-07-27 11:19:32 -04:00
Mark Szymanski e2f5a135c3 remove legacy super() call 2017-07-26 19:21:45 -05:00
jonathan vanasco 667896c557 some docs on request redirect detection 2017-07-26 15:32:07 -04:00
Bruno Alla b77c1a3deb Correct urllib3 compatibility comment
So that it's in line with the code. I saw the warning raised recently and had to dive into the code for exact compatibility, but I stopped after reading the comment rather than the code. 
Maybe a better solution would be to surface the supported versions in the warning, but I see it was changed recently in https://github.com/requests/requests/pull/4144/
2017-07-26 10:23:01 +01:00
Cory Benfield 6cc891fd32 v2.18.2 2017-07-25 16:21:48 +01:00
Alex Muller d8c2fdf92f Use 'prefix' instead of 'key' in session docstring
This commit makes the API docs more clear. The 'key' is an
implementation detail.
2017-07-20 10:06:34 +02:00
Nate Prewitt f6e07bb27f fix OPENSSL_VERSION_NUMBER check on Python2.6's ssl module 2017-07-03 17:21:56 -06:00
Alex Gaynor c054a722bb Removed legacy fallback for python3.2 2017-06-25 12:51:15 -04:00
Cory Benfield 51de61f914 v2.18.1 2017-06-14 18:50:53 +01:00