Commit Graph

327 Commits

Author SHA1 Message Date
Nate Prewitt f60324a3de append previous url fragment on redirect 2018-01-21 09:55:45 -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
jonathan vanasco 667896c557 some docs on request redirect detection 2017-07-26 15:32:07 -04: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
Justin Mayhew c6a6347156 Remove exec permission from files that shouldn't have it 2017-06-10 20:38:45 -03:00
kennethreitz 04ed1e5122 cleanup sessions.py 2017-05-29 23:02:23 -04:00
kennethreitz 4ad4670583 Merge pull request #4099 from requests/requests-namespace
Requests namespace
2017-05-29 13:15:20 -04:00
Benjamin Congdon 86f8cb8a35 Remove session redirect cache 2017-05-29 09:53:24 -07:00
kennethreitz 7f14db17c8 new requests namespace 2017-05-29 12:11:43 -04:00
kennethreitz 6ef7298466 fix sessions.py 2017-05-26 22:49:43 -04:00
kennethreitz 8c2a36140b fix for python 3 2017-05-26 22:08:46 -04:00
kennethreitz a7239aab84 feedback from @sigmavirus42 2017-05-26 21:23:55 -04:00
kennethreitz dfd667df96 who wrote this shit 2017-05-26 21:17:13 -04:00
kennethreitz f41560c5d4 fix the tests 2017-05-26 21:15:58 -04:00
kennethreitz ce64cce14e API improvements 2017-05-26 21:07:37 -04:00
Cory Benfield d89f8c0d70 Fix up Appveyor testing 2017-05-03 13:19:46 +01:00
shmuelamar 722b1dae96 fix handle of non-ascii location on redirects 2017-04-18 00:08:59 +03:00
shmuelamar a3e597c171 fix unicode decode error on py2 when handling redirect without scheme 2017-04-14 16:20:27 +03: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
Anthony Shaw a63ae02e34 Update sessions.py
Update docstring for the session init to explain what the cert kwarg types are for.
2017-04-02 20:29:48 +10:00
Bastien Gérard 4207867aaf PR review fixes:
- used httpbin_secure for tests
- updated docstring related to `verify` param"
- used TLS acronym instead of SSL
2017-03-22 21:28:38 +01:00
kennethreitz 6bd6249051 Merge pull request #3865 from JohnVillalovos/master
Allow use of 'no_proxy' in the proxies argument
2017-02-10 15:50:10 -06:00
jonathan vanasco 70f31a3166 * initial attempt at get_redirect_target
* removing the `i` from the redirect detection while-loop
2017-02-10 13:53:23 -05:00
John L. Villalovos 85400d8d67 Allow use of 'no_proxy' in the proxies argument
Add the ability to add 'no_proxy' and a value to the 'proxies'
dictionary argument.

https://github.com/kennethreitz/requests/issues/2817

Closes gh-2817
2017-02-10 09:41:54 -08:00
Nate Prewitt 40402cd0dd adding rewind for re-POST bodies 2016-11-02 09:56:56 -06:00
Brian Bamsch 087aeacee5 Change module of internal references to to_native_str() 2016-09-27 20:41:21 -07:00
Nate Prewitt 08a158f486 converting update call to merge_cookies call for cookielib compatibility 2016-09-20 12:20:00 -06:00
Richard van den Berg 80f304fd30 Specify self.cert is used for SSL client certificates 2016-08-26 15:17:31 +02:00
Michael Hunsinger 7c80222afa Fixed another scheme proxy over "all" priority 2016-08-22 21:01:13 -06:00
Nate Prewitt e50c61bc86 removing Content-Type and Transfer-Encoding headers on redirect 2016-08-11 10:58:20 -06:00
Ville Skyttä 542fbbc67f Document bunch of return types 2016-08-09 13:32:56 +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
Nate Prewitt 15a3869006 making module docstrings and coding comments consistent 2016-07-19 14:51:14 -06:00
Ian Cordasco de4c75bbad Update documentation of Session.max_redirects
Fixes #3250
2016-06-01 11:00:42 -05:00
Ian Cordasco cd4e6b9aef Merge pull request #3185 from brettdh/3183-support-all-proxy-env-var
Support ALL_PROXY environment variable
2016-05-17 10:42:31 -05:00
Cory Benfield 0838685dab Replace tab with appropriate spaces. 2016-05-12 10:57:52 +01:00
Brett Higgins 1121f8b915 Support ALL_PROXY environment variable
Closes #3183.
2016-05-11 10:37:53 -04:00
Kevin Burke ae1ac2d4e0 Flip conditional in session.send()
Previously we checked that the `request` being sent was an instance of a
PreparedRequest. If a user somehow created a PreparedRequest using a different
Requests library instance, this check makes the request un-sendable.

(This happened recently - unbeknownst to me, my server was running an outdated
version of pip, vulnerable to this issue - pypa/pip#1489, which creates
multiple subdirectories (src/requests, src/requests/requests) when you rerun
pip install --target. So the PreparedRequest was being created in one version
of the library and compared against the other version of the library, and
throwing this exception, even though they were both PreparedRequest instances!)

It would probably be preferable to check the object's behavior (instead of
its type), but a PreparedRequest has a lot of behavior, and it wouldn't be
really feasible or allow us to provide a helpful error message to check all
of it here. Instead flip the conditional to guard against the user sending an
unprepared Request, which should still give us most of the benefits of the
better error message.

Fixes #3102
2016-04-21 08:12:05 -07:00
liuyang 2981366f56 add rtype in session.request 2016-04-11 14:33:23 +08:00
Ben f24d56a1ce Consolidate logic for changing method during redirects
I only moved the code into a function, there was no actual change to
the code. I added a few tests to ensure we're doing things correctly.

The real point of me doing this is to make it easier to bring back
`strict_mode` functionality. For you requests youngsters in the crowd,
`strict_mode` followed the spec for redirects meaning the method
wouldn't change to a GET. The current code follows the browser
convention of changing the method to a GET when doing a 302 redirect.
However, lots of servers want you to follow the standards (the nerve!)
so I'd like to override the logic. Now that the method changing logic
is in `rebuild_method`, I can simply override that function instead of
overriding the entire `resolve_redirects` function as suggested by
kennethreitz/requests#1325
2016-03-17 23:16:39 -05:00
kennethreitz fc512d8924 Don't use redirect_cache if allow_redirects=False
Fix for #2997
2016-02-05 17:51:09 -05:00
Ryan Munro 6a8a480d6c Review changes to TooManyRedirect exception with response 2016-01-20 10:48:12 -08:00
Ryan Munro e6f218f3f6 Return request & response with TooManyRedirects 2016-01-19 16:44:58 -08:00
Brian Samek 9aca57d4bf Revert changes to params
This reverts commit 9a20afd6b5.

Docstring changes were desirable, but changes to params were not.
2015-12-11 16:47:47 -05:00
Brian Samek 9a20afd6b5 Refactor default params
Specified the default argument for params that have a default in the docstring
so that the default is easier to see from the code. Modified the docstring in
api.py to match the docstring in sessions.py.
2015-12-11 13:32:09 -05:00