summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.org>2017-05-29 13:17:57 -0400
committerKenneth Reitz <me@kennethreitz.org>2017-05-29 13:17:57 -0400
commit916d171f2bf01155f2c115159ec475e8d76a690b (patch)
treefc8b6743e9181850910a3c692970cff616ebee90
parent3857431159b56707965f9abce581e6ab0694604b (diff)
parent4ad46705834955b872da1257b1de4feb5a8a51b3 (diff)
downloadpython-requests-2.16.0.tar.gz
Merge branch 'master' of github.com:kennethreitz/requestsv2.17.02.16.0
-rw-r--r--HISTORY.rst16
-rw-r--r--README.rst24
-rw-r--r--docs/_templates/sidebarintro.html4
-rw-r--r--docs/community/support.rst2
-rw-r--r--docs/community/updates.rst2
-rw-r--r--docs/dev/contributing.rst2
-rw-r--r--docs/dev/todo.rst4
-rw-r--r--docs/index.rst8
-rw-r--r--docs/user/advanced.rst12
-rw-r--r--docs/user/install.rst2
-rw-r--r--requests/auth.py2
-rw-r--r--requests/models.py4
-rwxr-xr-xrequests/sessions.py30
-rw-r--r--requests/utils.py2
-rwxr-xr-xtests/test_lowlevel.py4
-rwxr-xr-xtests/test_requests.py4
-rw-r--r--tests/test_utils.py2
17 files changed, 49 insertions, 75 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 551ef357..4b52c198 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -600,7 +600,7 @@ This is the first release that follows our new release process. For more, see
- Unicode URL improvements for Python 2.
- Re-order JSON param for backwards compat.
-- Automatically defrag authentication schemes from host/pass URIs. (`#2249 <https://github.com/kennethreitz/requests/issues/2249>`_)
+- Automatically defrag authentication schemes from host/pass URIs. (`#2249 <https://github.com/requests/requests/issues/2249>`_)
2.4.2 (2014-10-05)
@@ -608,19 +608,19 @@ This is the first release that follows our new release process. For more, see
**Improvements**
-- FINALLY! Add json parameter for uploads! (`#2258 <https://github.com/kennethreitz/requests/pull/2258>`_)
-- Support for bytestring URLs on Python 3.x (`#2238 <https://github.com/kennethreitz/requests/pull/2238>`_)
+- FINALLY! Add json parameter for uploads! (`#2258 <https://github.com/requests/requests/pull/2258>`_)
+- Support for bytestring URLs on Python 3.x (`#2238 <https://github.com/requests/requests/pull/2238>`_)
**Bugfixes**
-- Avoid getting stuck in a loop (`#2244 <https://github.com/kennethreitz/requests/pull/2244>`_)
-- Multiple calls to iter* fail with unhelpful error. (`#2240 <https://github.com/kennethreitz/requests/issues/2240>`_, `#2241 <https://github.com/kennethreitz/requests/issues/2241>`_)
+- Avoid getting stuck in a loop (`#2244 <https://github.com/requests/requests/pull/2244>`_)
+- Multiple calls to iter* fail with unhelpful error. (`#2240 <https://github.com/requests/requests/issues/2240>`_, `#2241 <https://github.com/requests/requests/issues/2241>`_)
**Documentation**
-- Correct redirection introduction (`#2245 <https://github.com/kennethreitz/requests/pull/2245/>`_)
-- Added example of how to send multiple files in one request. (`#2227 <https://github.com/kennethreitz/requests/pull/2227/>`_)
-- Clarify how to pass a custom set of CAs (`#2248 <https://github.com/kennethreitz/requests/pull/2248/>`_)
+- Correct redirection introduction (`#2245 <https://github.com/requests/requests/pull/2245/>`_)
+- Added example of how to send multiple files in one request. (`#2227 <https://github.com/requests/requests/pull/2227/>`_)
+- Clarify how to pass a custom set of CAs (`#2248 <https://github.com/requests/requests/pull/2248/>`_)
diff --git a/README.rst b/README.rst
index bfe608b8..0e165b5f 100644
--- a/README.rst
+++ b/README.rst
@@ -10,16 +10,16 @@ Requests: HTTP for Humans
.. image:: https://img.shields.io/pypi/pyversions/requests.svg
:target: https://pypi.python.org/pypi/requests
-.. image:: https://travis-ci.org/kennethreitz/requests.svg?branch=master
- :target: https://travis-ci.org/kennethreitz/requests
+.. image:: https://travis-ci.org/requests/requests.svg?branch=master
+ :target: https://travis-ci.org/requests/requests
-.. image:: https://codecov.io/github/kennethreitz/requests/coverage.svg?branch=master
- :target: https://codecov.io/github/kennethreitz/requests
+.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master
+ :target: https://codecov.io/github/requests/requests
:alt: codecov.io
-
-.. image:: https://img.shields.io/github/contributors/kennethreitz/requests.svg
- :target: https://github.com/kennethreitz/requests/graphs/contributors
-
+
+.. image:: https://img.shields.io/github/contributors/requests/requests.svg
+ :target: https://github.com/requests/requests/graphs/contributors
+
.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
:target: https://saythanks.io/to/kennethreitz
@@ -50,7 +50,7 @@ Behold, the power of Requests:
See `the similar code, sans Requests <https://gist.github.com/973705>`_.
-.. image:: https://raw.githubusercontent.com/kennethreitz/requests/master/docs/_static/requests-logo-small.png
+.. image:: https://raw.githubusercontent.com/requests/requests/master/docs/_static/requests-logo-small.png
:target: http://docs.python-requests.org/
@@ -112,6 +112,6 @@ How to Contribute
#. Write a test which shows that the bug was fixed or that the feature works as expected.
#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.
-.. _`the repository`: http://github.com/kennethreitz/requests
-.. _AUTHORS: https://github.com/kennethreitz/requests/blob/master/AUTHORS.rst
-.. _Contributor Friendly: https://github.com/kennethreitz/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open
+.. _`the repository`: http://github.com/requests/requests
+.. _AUTHORS: https://github.com/requests/requests/blob/master/AUTHORS.rst
+.. _Contributor Friendly: https://github.com/requests/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open
diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html
index fe113734..71feba68 100644
--- a/docs/_templates/sidebarintro.html
+++ b/docs/_templates/sidebarintro.html
@@ -58,9 +58,9 @@
<p></p>
- <li><a href="http://github.com/kennethreitz/requests">Requests @ GitHub</a></li>
+ <li><a href="http://github.com/requests/requests">Requests @ GitHub</a></li>
<li><a href="http://pypi.python.org/pypi/requests">Requests @ PyPI</a></li>
- <li><a href="http://github.com/kennethreitz/requests/issues">Issue Tracker</a></li>
+ <li><a href="http://github.com/requests/requests/issues">Issue Tracker</a></li>
<li><a href="http://docs.python-requests.org/en/latest/community/updates/#software-updates">Release History</a></li>
</ul>
diff --git a/docs/community/support.rst b/docs/community/support.rst
index 63069308..4d5b0c35 100644
--- a/docs/community/support.rst
+++ b/docs/community/support.rst
@@ -26,7 +26,7 @@ File an Issue
If you notice some unexpected behaviour in Requests, or want to see support
for a new feature,
-`file an issue on GitHub <https://github.com/kennethreitz/requests/issues>`_.
+`file an issue on GitHub <https://github.com/requests/requests/issues>`_.
E-mail
diff --git a/docs/community/updates.rst b/docs/community/updates.rst
index b4897a83..e1f0d8db 100644
--- a/docs/community/updates.rst
+++ b/docs/community/updates.rst
@@ -12,7 +12,7 @@ GitHub
------
The best way to track the development of Requests is through
-`the GitHub repo <https://github.com/kennethreitz/requests>`_.
+`the GitHub repo <https://github.com/requests/requests>`_.
Twitter
-------
diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst
index 93181dad..265994b3 100644
--- a/docs/dev/contributing.rst
+++ b/docs/dev/contributing.rst
@@ -187,7 +187,7 @@ through the `GitHub issues`_, **both open and closed**, to confirm that the bug
hasn't been reported before. Duplicate bug reports are a huge drain on the time
of other contributors, and should be avoided as much as possible.
-.. _GitHub issues: https://github.com/kennethreitz/requests/issues
+.. _GitHub issues: https://github.com/requests/requests/issues
Feature Requests
diff --git a/docs/dev/todo.rst b/docs/dev/todo.rst
index d4862fbb..f2e572ce 100644
--- a/docs/dev/todo.rst
+++ b/docs/dev/todo.rst
@@ -6,11 +6,11 @@ Requests is under active development, and contributions are more than welcome!
#. Check for open issues or open a fresh issue to start a discussion around a bug.
There is a Contributor Friendly tag for issues that should be ideal for people who are not very
familiar with the codebase yet.
-#. Fork `the repository <https://github.com/kennethreitz/requests>`_ on GitHub and start making your
+#. Fork `the repository <https://github.com/requests/requests>`_ on GitHub and start making your
changes to a new branch.
#. Write a test which shows that the bug was fixed.
#. Send a pull request and bug the maintainer until it gets merged and published. :)
- Make sure to add yourself to `AUTHORS <https://github.com/kennethreitz/requests/blob/master/AUTHORS.rst>`_.
+ Make sure to add yourself to `AUTHORS <https://github.com/requests/requests/blob/master/AUTHORS.rst>`_.
Feature Freeze
--------------
diff --git a/docs/index.rst b/docs/index.rst
index 4caf556a..af88bfd3 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -17,11 +17,11 @@ Release v\ |version|. (:ref:`Installation <install>`)
.. image:: https://img.shields.io/pypi/pyversions/requests.svg
:target: https://pypi.python.org/pypi/requests
-.. image:: https://travis-ci.org/kennethreitz/requests.svg?branch=master
- :target: https://travis-ci.org/kennethreitz/requests
+.. image:: https://travis-ci.org/requests/requests.svg?branch=master
+ :target: https://travis-ci.org/requests/requests
-.. image:: https://codecov.io/github/kennethreitz/requests/coverage.svg?branch=master
- :target: https://codecov.io/github/kennethreitz/requests
+.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master
+ :target: https://codecov.io/github/requests/requests
:alt: codecov.io
.. image:: https://img.shields.io/badge/Say%20Thanks!-🦉-1EAEDB.svg
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst
index b7775f24..2aac434c 100644
--- a/docs/user/advanced.rst
+++ b/docs/user/advanced.rst
@@ -280,7 +280,7 @@ immediately. You can override this behaviour and defer downloading the response
body until you access the :attr:`Response.content <requests.Response.content>`
attribute with the ``stream`` parameter::
- tarball_url = 'https://github.com/kennethreitz/requests/tarball/master'
+ tarball_url = 'https://github.com/requests/requests/tarball/master'
r = requests.get(tarball_url, stream=True)
At this point only the response headers have been downloaded and the connection
@@ -642,7 +642,7 @@ from GitHub. Suppose we wanted commit ``a050faf`` on Requests. We would get it
like so::
>>> import requests
- >>> r = requests.get('https://api.github.com/repos/kennethreitz/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad')
+ >>> r = requests.get('https://api.github.com/repos/requests/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad')
We should confirm that GitHub responded correctly. If it has, we want to work
out what type of content it is. Do this like so::
@@ -697,12 +697,12 @@ we should probably avoid making ham-handed POSTS to it. Instead, let's play
with the Issues feature of GitHub.
This documentation was added in response to
-`Issue #482 <https://github.com/kennethreitz/requests/issues/482>`_. Given that
+`Issue #482 <https://github.com/requests/requests/issues/482>`_. Given that
this issue already exists, we will use it as an example. Let's start by getting it.
::
- >>> r = requests.get('https://api.github.com/repos/kennethreitz/requests/issues/482')
+ >>> r = requests.get('https://api.github.com/repos/requests/requests/issues/482')
>>> r.status_code
200
@@ -745,7 +745,7 @@ is to POST to the thread. Let's do it.
::
>>> body = json.dumps({u"body": u"Sounds great! I'll get right on it!"})
- >>> url = u"https://api.github.com/repos/kennethreitz/requests/issues/482/comments"
+ >>> url = u"https://api.github.com/repos/requests/requests/issues/482/comments"
>>> r = requests.post(url=url, data=body)
>>> r.status_code
@@ -779,7 +779,7 @@ that.
5804413
>>> body = json.dumps({u"body": u"Sounds great! I'll get right on it once I feed my cat."})
- >>> url = u"https://api.github.com/repos/kennethreitz/requests/issues/comments/5804413"
+ >>> url = u"https://api.github.com/repos/requests/requests/issues/comments/5804413"
>>> r = requests.patch(url=url, data=body, auth=auth)
>>> r.status_code
diff --git a/docs/user/install.rst b/docs/user/install.rst
index 922c489b..96884558 100644
--- a/docs/user/install.rst
+++ b/docs/user/install.rst
@@ -22,7 +22,7 @@ Get the Source Code
-------------------
Requests is actively developed on GitHub, where the code is
-`always available <https://github.com/kennethreitz/requests>`_.
+`always available <https://github.com/requests/requests>`_.
You can either clone the public repository::
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):
diff --git a/tests/test_lowlevel.py b/tests/test_lowlevel.py
index 301dc3e4..c87234bc 100755
--- a/tests/test_lowlevel.py
+++ b/tests/test_lowlevel.py
@@ -28,7 +28,7 @@ def test_digestauth_401_count_reset_on_redirect():
"""Ensure we correctly reset num_401_calls after a successful digest auth,
followed by a 302 redirect to another digest auth prompt.
- See https://github.com/kennethreitz/requests/issues/1979.
+ See https://github.com/requests/requests/issues/1979.
"""
text_401 = (b'HTTP/1.1 401 UNAUTHORIZED\r\n'
b'Content-Length: 0\r\n'
@@ -138,7 +138,7 @@ def test_digestauth_401_only_sent_once():
def test_digestauth_only_on_4xx():
"""Ensure we only send digestauth on 4xx challenges.
- See https://github.com/kennethreitz/requests/issues/3772.
+ See https://github.com/requests/requests/issues/3772.
"""
text_200_chal = (b'HTTP/1.1 200 OK\r\n'
b'Content-Length: 0\r\n'
diff --git a/tests/test_requests.py b/tests/test_requests.py
index 3cb56c33..b8350cb7 100755
--- a/tests/test_requests.py
+++ b/tests/test_requests.py
@@ -455,7 +455,7 @@ class TestRequests:
@pytest.mark.parametrize('key', ('User-agent', 'user-agent'))
def test_user_agent_transfers(self, httpbin, key):
- heads = {key: 'Mozilla/5.0 (github.com/kennethreitz/requests)'}
+ heads = {key: 'Mozilla/5.0 (github.com/requests/requests)'}
r = requests.get(httpbin('user-agent'), headers=heads)
assert heads[key] in r.text
@@ -2075,7 +2075,7 @@ class TestTimeout:
pass
def test_encoded_methods(self, httpbin):
- """See: https://github.com/kennethreitz/requests/issues/2316"""
+ """See: https://github.com/requests/requests/issues/2316"""
r = requests.request(b'GET', httpbin('get'))
assert r.ok
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 0b37e57f..41858b37 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -367,7 +367,7 @@ def test_get_auth_from_url(url, auth):
),
))
def test_requote_uri_with_unquoted_percents(uri, expected):
- """See: https://github.com/kennethreitz/requests/issues/2356"""
+ """See: https://github.com/requests/requests/issues/2356"""
assert requote_uri(uri) == expected