diff options
| author | Kenneth Reitz <me@kennethreitz.org> | 2017-05-29 13:17:57 -0400 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.org> | 2017-05-29 13:17:57 -0400 |
| commit | 916d171f2bf01155f2c115159ec475e8d76a690b (patch) | |
| tree | fc8b6743e9181850910a3c692970cff616ebee90 /requests | |
| parent | 3857431159b56707965f9abce581e6ab0694604b (diff) | |
| parent | 4ad46705834955b872da1257b1de4feb5a8a51b3 (diff) | |
| download | python-requests-2.16.0.tar.gz | |
Diffstat (limited to 'requests')
| -rw-r--r-- | requests/auth.py | 2 | ||||
| -rw-r--r-- | requests/models.py | 4 | ||||
| -rwxr-xr-x | requests/sessions.py | 30 | ||||
| -rw-r--r-- | requests/utils.py | 2 |
4 files changed, 6 insertions, 32 deletions
diff --git a/requests/auth.py b/requests/auth.py index cd9be911..a44b4d15 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -227,7 +227,7 @@ class HTTPDigestAuth(AuthBase): """ # If response is not 4xx, do not auth - # See https://github.com/kennethreitz/requests/issues/3772 + # See https://github.com/requests/requests/issues/3772 if not 400 <= r.status_code < 500: self._thread_local.num_401_calls = 1 return r diff --git a/requests/models.py b/requests/models.py index b4a523d9..c22cc1c9 100644 --- a/requests/models.py +++ b/requests/models.py @@ -13,7 +13,7 @@ import sys # Import encoding now, to avoid implicit import later. # Implicit import within threads may cause LookupError when standard library is in a ZIP, -# such as in Embedded Python. See https://github.com/kennethreitz/requests/issues/3578. +# such as in Embedded Python. See https://github.com/requests/requests/issues/3578. import encodings.idna from urllib3.fields import RequestField @@ -348,7 +348,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): #: We're unable to blindly call unicode/str functions #: as this will include the bytestring indicator (b'') #: on python 3.x. - #: https://github.com/kennethreitz/requests/pull/2238 + #: https://github.com/requests/requests/pull/2238 if isinstance(url, bytes): url = url.decode('utf8') else: diff --git a/requests/sessions.py b/requests/sessions.py index 9b74f5dd..a0f290b7 100755 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -13,8 +13,6 @@ import time from collections import Mapping from datetime import timedelta -from urllib3._collections import RecentlyUsedContainer - from .auth import _basic_auth_str from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse from .cookies import ( @@ -39,8 +37,6 @@ from .status_codes import codes # formerly defined here, reexposed here for backward compatibility from .models import REDIRECT_STATI -REDIRECT_CACHE_SIZE = 1000 - # Preferred clock, based on which one is more accurate on a given system. if platform.system() == 'Windows': try: # Python 3.3+ @@ -158,15 +154,12 @@ class SessionRedirectMixin(object): url = requote_uri(url) prepared_request.url = to_native_string(url) - # Cache the url, unless it redirects to itself. - if resp.is_permanent_redirect and req.url != prepared_request.url: - self.redirect_cache[req.url] = prepared_request.url self.rebuild_method(prepared_request, resp) - # https://github.com/kennethreitz/requests/issues/1084 + # https://github.com/requests/requests/issues/1084 if resp.status_code not in (codes.temporary_redirect, codes.permanent_redirect): - # https://github.com/kennethreitz/requests/issues/3490 + # https://github.com/requests/requests/issues/3490 purged_headers = ('Content-Length', 'Content-Type', 'Transfer-Encoding') for header in purged_headers: prepared_request.headers.pop(header, None) @@ -393,9 +386,6 @@ class Session(SessionRedirectMixin): self.mount('https://', HTTPAdapter()) self.mount('http://', HTTPAdapter()) - # Only store 1000 redirects to prevent using infinite memory - self.redirect_cache = RecentlyUsedContainer(REDIRECT_CACHE_SIZE) - def __enter__(self): return self @@ -623,16 +613,6 @@ class Session(SessionRedirectMixin): stream = kwargs.get('stream') hooks = request.hooks - # Resolve URL in redirect cache, if available. - if allow_redirects: - checked_urls = set() - while request.url in self.redirect_cache: - checked_urls.add(request.url) - new_url = self.redirect_cache.get(request.url) - if new_url in checked_urls: - break - request.url = new_url - # Get the appropriate adapter to use adapter = self.get_adapter(url=request.url) @@ -745,18 +725,12 @@ class Session(SessionRedirectMixin): def __getstate__(self): state = dict((attr, getattr(self, attr, None)) for attr in self.__attrs__) - state['redirect_cache'] = dict(self.redirect_cache) return state def __setstate__(self, state): - redirect_cache = state.pop('redirect_cache', {}) for attr, value in state.items(): setattr(self, attr, value) - self.redirect_cache = RecentlyUsedContainer(REDIRECT_CACHE_SIZE) - for redirect, to in redirect_cache.items(): - self.redirect_cache[redirect] = to - def session(): """ diff --git a/requests/utils.py b/requests/utils.py index 5976192f..056f6fb3 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -171,7 +171,7 @@ def get_netrc_auth(url, raise_errors=False): except KeyError: # os.path.expanduser can fail when $HOME is undefined and # getpwuid fails. See http://bugs.python.org/issue20164 & - # https://github.com/kennethreitz/requests/issues/1846 + # https://github.com/requests/requests/issues/1846 return if os.path.exists(loc): |
