Commit Graph

328 Commits

Author SHA1 Message Date
jonathan vanasco 8e07dae0fd altered internal loops of how `SessionRedirectMixin.resolve_redirects and Session.send` handle redirect history. 3.0.0 branch 2017-02-22 13:23:21 -05:00
Nate Prewitt b8a87e00d7 variable name consistency 2017-02-14 09:31:59 -07:00
Cory Benfield 56dd77fc52 Merge branch 'master' into proposed/3.0.0 2017-02-14 15:59:53 +00:00
Nate Prewitt 16bbc7478f revert removal of request param from resolve_redirects 2017-02-11 23:35:19 -07: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 eff932627c adding return variable to rebuild_method for method change 2016-12-10 12:13:13 -07:00
Nate Prewitt 084fb05d52 fixing redirects for non-GET/HEAD/POST methods 2016-12-10 12:12:23 -07:00
Nate Prewitt 84d99f01f5 add enforce_content_length=True default 2016-11-15 11:27:29 -07:00
Cory Benfield 7f88aca8f7 Merge branch 'master' into proposed/3.0.0 2016-11-15 17:16:04 +00:00
Nate Prewitt 40402cd0dd adding rewind for re-POST bodies 2016-11-02 09:56:56 -06:00
Jeremy Cline 35bdfc78c9 Keep `verify` setting when no CA_BUNDLE variable exists
If the ``trust_env`` flag is set on a session and ``verify`` is ``True``
or ``None``, the environment is checked for ``CURL_CA_BUNDLE`` and
``REQUESTS_CA_BUNDLE``. Before this patch, if neither existed,
``verify`` would always be set to ``None`` rather than ``True`` even if
it was originally ``True``.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
2016-10-24 20:32:12 -04: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
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
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
Nate Prewitt c418c4c4aa moving implementation details into util func 2016-07-16 12:37:42 -06:00
Nate Prewitt fd4332916f raise InvalidHeader on multiple Location values 2016-07-16 10:03:19 -06:00
Casey Davidson ed07583f7e Change exception and variable names so that tests will run (currently one failing test). 2016-07-01 16:38:46 -07: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
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
Ian Cordasco 9fc765638f Merge pull request #2754 from Lukasa/python3-redirect-3.0.0
Fix unicode redirects on Python 3.
2016-04-15 16:39:18 -05:00
liuyang 2981366f56 add rtype in session.request 2016-04-11 14:33:23 +08:00
Cory Benfield eab12fa029 Fixup Python 3 test failures. 2016-04-07 08:43:38 +01:00
Cory Benfield aedc0e515d Handle complex redirect URIs on Python 3 2016-04-07 08:35:30 +01:00
Cory Benfield b644af0ec7 Make sure we build environment settings properly. 2016-04-07 08:34:12 +01: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
kennethreitz be83be2457 lots of docstrings 2016-02-02 01:42:48 -05:00
kennethreitz 0d8f38a403 cleaned up Session.resolve_redirects() code 2016-02-02 00:56:53 -05:00
kennethreitz 66eedec782 Session.resolve_redirects code cleanup 2016-02-02 00:48:09 -05:00
kennethreitz 4dfe7a4885 Remove req argument from Session.resolve_redirects 2016-02-02 00:31:08 -05:00
kennethreitz a0b7bdd187 Merge commit '1881851' into v3.0.0 2016-02-01 23:57:29 -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
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
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