From 5dcbdb50fc9652cbeffeec22a21d1196e938bfca Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Fri, 25 Aug 2017 22:12:34 -0400
Subject: [PATCH 017/276] docs update
---
docs/_templates/hacks.html | 12 +++++++++++-
docs/conf.py | 6 +++---
docs/index.rst | 2 +-
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/docs/_templates/hacks.html b/docs/_templates/hacks.html
index f9fc96cb..c92ea0b2 100644
--- a/docs/_templates/hacks.html
+++ b/docs/_templates/hacks.html
@@ -51,4 +51,14 @@
var easter_egg = new Konami('http://fortunes.herokuapp.com/random/raw');
-
\ No newline at end of file
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
index b1c941e1..949e1cab 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -58,7 +58,7 @@ master_doc = 'index'
# General information about the project.
project = u'Requests'
-copyright = u'MMXVII. A Kenneth Reitz Project'
+copyright = u'MMXVII. A Kenneth Reitz Project'
author = u'Kenneth Reitz'
# The version info for the project you're documenting, acts as replacement for
@@ -128,7 +128,7 @@ html_theme_options = {
'show_powered_by': False,
'github_user': 'requests',
'github_repo': 'requests',
- 'github_banner': True,
+ 'github_banner': False,
'show_related': False
}
@@ -167,7 +167,7 @@ html_static_path = ['_static']
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-html_use_smartypants = False
+html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
html_sidebars = {
diff --git a/docs/index.rst b/docs/index.rst
index d4778ae0..3879dfd2 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -82,7 +82,7 @@ Institutions that prefer to be unnamed claim to use Requests internally.
simple, Pythonic.*
Requests is one of the most downloaded Python packages of all time, pulling in
-over 11,000,000 downloads every month. All the cool kids are doing it!
+over 13,000,000 downloads every month. All the cool kids are doing it!
Beloved Features
----------------
From 3a2ea9debac665fed6f5bdac0f1084067e3f0060 Mon Sep 17 00:00:00 2001
From: Cory Benfield
Date: Sun, 27 Aug 2017 08:54:01 +0100
Subject: [PATCH 018/276] Pin to httpbin 0.5.0
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/requirements.txt b/requirements.txt
index 8d79283f..d7ad8765 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,3 +14,4 @@ docutils
flake8
tox
detox
+httpbin==0.5.0
From dd57439fa56ffa1eb69b9b6d36763924952bc031 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Sun, 27 Aug 2017 23:13:50 -0400
Subject: [PATCH 019/276] Update README.rst
---
README.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.rst b/README.rst
index fe6cf5f6..c4730b41 100644
--- a/README.rst
+++ b/README.rst
@@ -86,11 +86,11 @@ Requests officially supports Python 2.6–2.7 & 3.3–3.7, and runs great on PyP
Installation
------------
-To install Requests, simply:
+To install Requests, simply use `pipenv `_ (or pip, of course):
.. code-block:: bash
- $ pip install requests
+ $ pipenv install requests
✨🍰✨
Satisfaction guaranteed.
From 3cceee3459e57fa56fb9218707230ab57b8995d4 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Sun, 27 Aug 2017 23:16:32 -0400
Subject: [PATCH 020/276] Update install.rst
---
docs/user/install.rst | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/user/install.rst b/docs/user/install.rst
index 43ed789b..5c128cf2 100644
--- a/docs/user/install.rst
+++ b/docs/user/install.rst
@@ -7,14 +7,14 @@ This part of the documentation covers the installation of Requests.
The first step to using any software package is getting it properly installed.
-$ pip install requests
-----------------------
+$ pipenv install requests
+-------------------------
To install Requests, simply run this simple command in your terminal of choice::
- $ pip install requests
+ $ pipenv install requests
-If you don't have `pip `_ installed (tisk tisk!),
+If you don't have `pipenv `_ installed (tisk tisk!), head over to the Pipenv website for installation instructions. Or, if you prefer to just use pip and don't have it installed,
`this Python installation guide `_
can guide you through the process.
From 3a6dec98270d00fcf7950b1f468dedf72224e87d Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Mon, 28 Aug 2017 01:29:29 -0400
Subject: [PATCH 021/276] Update index.rst
---
docs/index.rst | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/docs/index.rst b/docs/index.rst
index 3879dfd2..a0cd4dc6 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -28,9 +28,7 @@ Release v\ |version|. (:ref:`Installation `)
**Requests** is the only *Non-GMO* HTTP library for Python, safe for human
consumption.
-*Warning: Recreational use of the Python standard library for HTTP may result in dangerous side-effects,
-including: security vulnerabilities, verbose code, reinventing the wheel,
-constantly reading documentation, depression, headaches, or even death.*
+.. warning:: The use of Python 3 is highly preferred over Python 2. Please consider upgrading your applications and infrastructure, if you find yourself *still* using Python 2 in production. If you are using Python 3, congratulations — you are indeed a person of excellent taste.*
-------------------
From ad1aff52a03209bec66c932bc7c3739f6c52696c Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Mon, 28 Aug 2017 01:33:32 -0400
Subject: [PATCH 022/276] Update index.rst
---
docs/index.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/index.rst b/docs/index.rst
index a0cd4dc6..2c0a4844 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -28,7 +28,7 @@ Release v\ |version|. (:ref:`Installation `)
**Requests** is the only *Non-GMO* HTTP library for Python, safe for human
consumption.
-.. warning:: The use of Python 3 is highly preferred over Python 2. Please consider upgrading your applications and infrastructure, if you find yourself *still* using Python 2 in production. If you are using Python 3, congratulations — you are indeed a person of excellent taste.*
+.. warning:: The use of **Python 3** is _highly_ preferred over Python 2. Please consider upgrading your applications and infrastructure, if you find yourself *still* using Python 2 in production. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
-------------------
From 7e20b9193a59fe4925fbb93deddc3102355ac22f Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Mon, 28 Aug 2017 01:33:45 -0400
Subject: [PATCH 023/276] Update index.rst
---
docs/index.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/index.rst b/docs/index.rst
index 2c0a4844..33cb0227 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -28,7 +28,7 @@ Release v\ |version|. (:ref:`Installation `)
**Requests** is the only *Non-GMO* HTTP library for Python, safe for human
consumption.
-.. warning:: The use of **Python 3** is _highly_ preferred over Python 2. Please consider upgrading your applications and infrastructure, if you find yourself *still* using Python 2 in production. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
+.. warning:: The use of **Python 3** is *highly* preferred over Python 2. Please consider upgrading your applications and infrastructure, if you find yourself *still* using Python 2 in production. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
-------------------
From 572d2f453464a2733253eab3d85109fccfb483d4 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Mon, 28 Aug 2017 01:50:35 -0400
Subject: [PATCH 024/276] =?UTF-8?q?Python=202=20Death=20Sentence=E2=84=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Kenneth Reitz
---
docs/_templates/hacks.html | 44 +++++++++++++++++++++++--------
docs/_templates/sidebarintro.html | 2 +-
docs/_templates/sidebarlogo.html | 2 +-
3 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/docs/_templates/hacks.html b/docs/_templates/hacks.html
index c92ea0b2..0d88a6ec 100644
--- a/docs/_templates/hacks.html
+++ b/docs/_templates/hacks.html
@@ -1,4 +1,34 @@
+
+
+
+
+
+
+
+
+
@@ -51,14 +83,4 @@
var easter_egg = new Konami('http://fortunes.herokuapp.com/random/raw');
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html
index edd6731f..adf031cd 100644
--- a/docs/_templates/sidebarintro.html
+++ b/docs/_templates/sidebarintro.html
@@ -31,7 +31,7 @@
From 369be8afd07e7a0f38bc4f78d6f3764a800711aa Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Mon, 28 Aug 2017 02:01:36 -0400
Subject: [PATCH 025/276] pretty little note
Signed-off-by: Kenneth Reitz
---
docs/conf.py | 9 +++++----
docs/index.rst | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index 949e1cab..4bda98b0 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -58,7 +58,7 @@ master_doc = 'index'
# General information about the project.
project = u'Requests'
-copyright = u'MMXVII. A Kenneth Reitz Project'
+copyright = u'MMXVII. A Kenneth Reitz Project'
author = u'Kenneth Reitz'
# The version info for the project you're documenting, acts as replacement for
@@ -128,8 +128,9 @@ html_theme_options = {
'show_powered_by': False,
'github_user': 'requests',
'github_repo': 'requests',
- 'github_banner': False,
- 'show_related': False
+ 'github_banner': True,
+ 'show_related': False,
+ 'note_bg': '#FFF59C'
}
# Add any paths that contain custom themes here, relative to this directory.
@@ -167,7 +168,7 @@ html_static_path = ['_static']
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-html_use_smartypants = True
+html_use_smartypants = False
# Custom sidebar templates, maps document names to template names.
html_sidebars = {
diff --git a/docs/index.rst b/docs/index.rst
index 33cb0227..919caaac 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -28,7 +28,8 @@ Release v\ |version|. (:ref:`Installation `)
**Requests** is the only *Non-GMO* HTTP library for Python, safe for human
consumption.
-.. warning:: The use of **Python 3** is *highly* preferred over Python 2. Please consider upgrading your applications and infrastructure, if you find yourself *still* using Python 2 in production. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
+.. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
+ —*Kenneth Reitz*
-------------------
From 785c733415d605e332ca608cbabcb9dfe0442f88 Mon Sep 17 00:00:00 2001
From: Pascal Van Acker
Date: Mon, 28 Aug 2017 10:58:44 +0200
Subject: [PATCH 026/276] Add environment info to prepared requests
When using prepared requests, the environment is not taken into account. This should be reflected in the documentation.
---
docs/user/advanced.rst | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst
index 4aa1dfac..c7f960fa 100644
--- a/docs/user/advanced.rst
+++ b/docs/user/advanced.rst
@@ -187,6 +187,25 @@ applied, replace the call to :meth:`Request.prepare()
print(resp.status_code)
+When you are using the prepared request flow, keep in mind that it does not take into account the environment.
+This can cause problems if you are using environment variables to change the behaviour of requests.
+For example: Self-signed SSL certificates specified in ``REQUESTS_CA_BUNDLE`` will not be taken into account.
+As a result an ``SSL: CERTIFICATE_VERIFY_FAILED`` is thrown.
+You can get around this behaviour by explicity merging the environment settings into your session:
+
+ from requests import Request, Session
+
+ s = Session()
+ req = Request('GET', url)
+
+ prepped = s.prepare_request(req)
+
+ # Merge environment settings into session
+ settings = s.merge_environment_settings(prepped.url, None, None, None, None)
+ resp = s.send(prepped, **settings)
+
+ print(resp.status_code)
+
.. _verification:
SSL Cert Verification
From ac9a3e53206e7f059c4a232aa7780ba42c232d7b Mon Sep 17 00:00:00 2001
From: Pascal Van Acker
Date: Mon, 28 Aug 2017 11:14:05 +0200
Subject: [PATCH 027/276] fixed syntax for code block for prepared requests
---
docs/user/advanced.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst
index c7f960fa..2a03a0e1 100644
--- a/docs/user/advanced.rst
+++ b/docs/user/advanced.rst
@@ -191,7 +191,7 @@ When you are using the prepared request flow, keep in mind that it does not take
This can cause problems if you are using environment variables to change the behaviour of requests.
For example: Self-signed SSL certificates specified in ``REQUESTS_CA_BUNDLE`` will not be taken into account.
As a result an ``SSL: CERTIFICATE_VERIFY_FAILED`` is thrown.
-You can get around this behaviour by explicity merging the environment settings into your session:
+You can get around this behaviour by explicity merging the environment settings into your session::
from requests import Request, Session
From 96b9a3f0fc7551aa3c2d25b093ba85a49d5b0497 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Mon, 28 Aug 2017 12:25:26 -0400
Subject: [PATCH 028/276] Update setup.py
---
setup.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/setup.py b/setup.py
index ed4892d4..7aa8d611 100755
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# Learn more: https://github.com/kennethreitz/setup.py
import os
import re
From e0e5b2e3aa23a805c8bc8adbd54af57ff37ead5c Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Tue, 29 Aug 2017 16:16:52 -0400
Subject: [PATCH 029/276] Update philosophy.rst
---
docs/dev/philosophy.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/dev/philosophy.rst b/docs/dev/philosophy.rst
index c0c0612f..fcc2a35e 100644
--- a/docs/dev/philosophy.rst
+++ b/docs/dev/philosophy.rst
@@ -31,6 +31,10 @@ Standard Library?
Requests has no *active* plans to be included in the standard library. This decision has been discussed at length with Guido as well as numerous core developers.
+.. raw:: html
+
+
+
Essentially, the standard library is where a library goes to die. It is appropriate for a module to be included when active development is no longer necessary.
Linux Distro Packages
From 940c1246e0b84442f72c9e78566b5e298b716cde Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Fri, 1 Sep 2017 13:10:29 -0400
Subject: [PATCH 030/276] taste
---
docs/_templates/sidebarintro.html | 2 --
1 file changed, 2 deletions(-)
diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html
index adf031cd..7e1795a3 100644
--- a/docs/_templates/sidebarintro.html
+++ b/docs/_templates/sidebarintro.html
@@ -25,8 +25,6 @@
Receive updates on new releases and upcoming projects.
diff --git a/docs/_templates/sidebarlogo.html b/docs/_templates/sidebarlogo.html
index fba676f1..b31c3477 100644
--- a/docs/_templates/sidebarlogo.html
+++ b/docs/_templates/sidebarlogo.html
@@ -13,7 +13,7 @@
human beings. You are currently looking at the documentation of the
development release.
diff --git a/docs/community/out-there.rst b/docs/community/out-there.rst
index 5ce5f79f..63e70169 100644
--- a/docs/community/out-there.rst
+++ b/docs/community/out-there.rst
@@ -18,7 +18,7 @@ Articles & Talks
- `Python for the Web `_ teaches how to use Python to interact with the web, using Requests.
- `Daniel Greenfeld's Review of Requests `_
- `My 'Python for Humans' talk `_ ( `audio `_ )
-- `Issac Kelly's 'Consuming Web APIs' talk `_
+- `Issac Kelly's 'Consuming Web APIs' talk `_
- `Blog post about Requests via Yum `_
- `Russian blog post introducing Requests `_
- `Sending JSON in Requests `_
diff --git a/docs/community/recommended.rst b/docs/community/recommended.rst
index 0f652d54..88dcce8d 100644
--- a/docs/community/recommended.rst
+++ b/docs/community/recommended.rst
@@ -34,7 +34,7 @@ but do not belong in Requests proper. This library is actively maintained
by members of the Requests core team, and reflects the functionality most
requested by users within the community.
-.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/en/latest/index.html
+.. _Requests-Toolbelt: https://toolbelt.readthedocs.io/en/latest/index.html
Requests-Threads
diff --git a/docs/conf.py b/docs/conf.py
index 4bda98b0..503448d3 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -376,4 +376,4 @@ epub_exclude_files = ['search.html']
# If false, no index is generated.
#epub_use_index = True
-intersphinx_mapping = {'urllib3': ('http://urllib3.readthedocs.io/en/latest', None)}
+intersphinx_mapping = {'urllib3': ('https://urllib3.readthedocs.io/en/latest', None)}
diff --git a/docs/dev/todo.rst b/docs/dev/todo.rst
index 50b18155..707dea31 100644
--- a/docs/dev/todo.rst
+++ b/docs/dev/todo.rst
@@ -61,5 +61,5 @@ Requests currently supports the following versions of Python:
Google AppEngine is not officially supported although support is available
with the `Requests-Toolbelt`_.
-.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/
+.. _Requests-Toolbelt: https://toolbelt.readthedocs.io/
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst
index 587b3fdc..1bad6435 100644
--- a/docs/user/advanced.rst
+++ b/docs/user/advanced.rst
@@ -287,7 +287,7 @@ system.
For the sake of security we recommend upgrading certifi frequently!
.. _HTTP persistent connection: https://en.wikipedia.org/wiki/HTTP_persistent_connection
-.. _connection pooling: http://urllib3.readthedocs.io/en/latest/reference/index.html#module-urllib3.connectionpool
+.. _connection pooling: https://urllib3.readthedocs.io/en/latest/reference/index.html#module-urllib3.connectionpool
.. _certifi: http://certifi.io/
.. _Mozilla trust store: https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt
@@ -657,7 +657,7 @@ When you receive a response, Requests makes a guess at the encoding to
use for decoding the response when you access the :attr:`Response.text
` attribute. Requests will first check for an
encoding in the HTTP header, and if none is present, will use `chardet
-`_ to attempt to guess the encoding.
+`_ to attempt to guess the encoding.
The only time Requests will not do this is if no explicit charset
is present in the HTTP headers **and** the ``Content-Type``
@@ -884,7 +884,7 @@ Link Headers
Many HTTP APIs feature Link headers. They make APIs more self describing and
discoverable.
-GitHub uses these for `pagination `_
+GitHub uses these for `pagination `_
in their API, for example::
>>> url = 'https://api.github.com/users/kennethreitz/repos?page=1&per_page=10'
diff --git a/docs/user/authentication.rst b/docs/user/authentication.rst
index 8ffab504..411f79fd 100644
--- a/docs/user/authentication.rst
+++ b/docs/user/authentication.rst
@@ -136,11 +136,11 @@ Further examples can be found under the `Requests organization`_ and in the
.. _OAuth: http://oauth.net/
.. _requests_oauthlib: https://github.com/requests/requests-oauthlib
-.. _requests-oauthlib OAuth2 documentation: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html
-.. _Web Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow
-.. _Mobile Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#mobile-application-flow
-.. _Legacy Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#legacy-application-flow
-.. _Backend Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow
+.. _requests-oauthlib OAuth2 documentation: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html
+.. _Web Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow
+.. _Mobile Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#mobile-application-flow
+.. _Legacy Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#legacy-application-flow
+.. _Backend Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow
.. _Kerberos: https://github.com/requests/requests-kerberos
.. _NTLM: https://github.com/requests/requests-ntlm
.. _Requests organization: https://github.com/requests
From 620a5391c38a2eef86ba69748833aa3c00aaef62 Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Wed, 10 Jan 2018 18:37:22 -0800
Subject: [PATCH 108/276] Remove unsupported Python 3.3 from tox.ini
Python 3.3 is not a supported version so don't test it.
---
tox.ini | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tox.ini b/tox.ini
index 2a961c82..38bf3ac4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,8 +1,8 @@
[tox]
-envlist = py26,py27,py33,py34,py35,py36
+envlist = py26,py27,py34,py35,py36
[testenv]
commands =
pip install -e .[socks]
- python setup.py test
\ No newline at end of file
+ python setup.py test
From 7cefa939f5a0b25d8792a949b7ae708412d62681 Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Wed, 10 Jan 2018 18:33:06 -0800
Subject: [PATCH 109/276] Pass python_requires argument to setuptools
Helps pip decide what version of the library to install.
https://packaging.python.org/tutorials/distributing-packages/#python-requires
> If your project only runs on certain Python versions, setting the
> python_requires argument to the appropriate PEP 440 version specifier
> string will prevent pip from installing the project on other Python
> versions.
https://setuptools.readthedocs.io/en/latest/setuptools.html#new-and-changed-setup-keywords
> python_requires
>
> A string corresponding to a version specifier (as defined in PEP 440)
> for the Python version, used to specify the Requires-Python defined in
> PEP 345.
---
setup.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/setup.py b/setup.py
index e3bc8761..f32cca75 100755
--- a/setup.py
+++ b/setup.py
@@ -72,6 +72,7 @@ setup(
package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},
package_dir={'requests': 'requests'},
include_package_data=True,
+ python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
install_requires=requires,
license=about['__license__'],
zip_safe=False,
From 2255c34a65b5b1353004dc8d49cc397cd794ec15 Mon Sep 17 00:00:00 2001
From: Darren Dormer
Date: Tue, 12 Dec 2017 15:53:09 +0100
Subject: [PATCH 110/276] Fix DNS resolution by using hostname instead of
netloc and strip username and password when comparing against proxy bypass
items.
---
AUTHORS.rst | 1 +
HISTORY.rst | 3 ++-
requests/utils.py | 19 +++++++++++--------
tests/test_utils.py | 25 +++++++++++++++++++++++--
4 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/AUTHORS.rst b/AUTHORS.rst
index 481ac6c7..2b4494ba 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -182,3 +182,4 @@ Patches and Suggestions
- Arthur Vigil (`@ahvigil `_)
- Nehal J Wani (`@nehaljwani `_)
- Demetrios Bairaktaris (`@DemetriosBairaktaris `_)
+- Darren Dormer (`@ddormer `_)
diff --git a/HISTORY.rst b/HISTORY.rst
index b099ecdb..db1d1f70 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -17,7 +17,8 @@ dev
- Fixed issue where loading the default certificate bundle from a zip archive
would raise an ``IOError``
- Fixed issue with unexpected ``ImportError`` on windows system which do not support ``winreg`` module
-
+- DNS resolution in proxy bypass no longer includes the username and password in
+ the request. This also fixes the issue of DNS queries failing on macOS.
2.18.4 (2017-08-15)
+++++++++++++++++++
diff --git a/requests/utils.py b/requests/utils.py
index 8c1b9bec..df18a0bf 100644
--- a/requests/utils.py
+++ b/requests/utils.py
@@ -703,28 +703,31 @@ def should_bypass_proxies(url, no_proxy):
no_proxy_arg = no_proxy
if no_proxy is None:
no_proxy = get_proxy('no_proxy')
- netloc = urlparse(url).netloc
+ parsed = urlparse(url)
if no_proxy:
# We need to check whether we match here. We need to see if we match
- # the end of the netloc, both with and without the port.
+ # the end of the hostname, both with and without the port.
no_proxy = (
host for host in no_proxy.replace(' ', '').split(',') if host
)
- ip = netloc.split(':')[0]
- if is_ipv4_address(ip):
+ if is_ipv4_address(parsed.hostname):
for proxy_ip in no_proxy:
if is_valid_cidr(proxy_ip):
- if address_in_network(ip, proxy_ip):
+ if address_in_network(parsed.hostname, proxy_ip):
return True
- elif ip == proxy_ip:
+ elif parsed.hostname == proxy_ip:
# If no_proxy ip was defined in plain IP notation instead of cidr notation &
# matches the IP of the index
return True
else:
+ host_with_port = parsed.hostname
+ if parsed.port:
+ host_with_port += ':{0}'.format(parsed.port)
+
for host in no_proxy:
- if netloc.endswith(host) or netloc.split(':')[0].endswith(host):
+ if parsed.hostname.endswith(host) or host_with_port.endswith(host):
# The URL does match something in no_proxy, so we don't want
# to apply the proxies on this URL.
return True
@@ -737,7 +740,7 @@ def should_bypass_proxies(url, no_proxy):
# legitimate problems.
with set_environ('no_proxy', no_proxy_arg):
try:
- bypass = proxy_bypass(netloc)
+ bypass = proxy_bypass(parsed.hostname)
except (TypeError, socket.gaierror):
bypass = False
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 01cabe23..f39cd67b 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -614,6 +614,7 @@ def test_urldefragauth(url, expected):
('http://172.16.1.1/', True),
('http://172.16.1.1:5000/', True),
('http://localhost.localdomain:5000/v1.0/', True),
+ ('http://google.com:6000/', True),
('http://172.16.1.12/', False),
('http://172.16.1.12:5000/', False),
('http://google.com:5000/v1.0/', False),
@@ -622,11 +623,31 @@ def test_should_bypass_proxies(url, expected, monkeypatch):
"""Tests for function should_bypass_proxies to check if proxy
can be bypassed or not
"""
- monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
- monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
+ monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1, google.com:6000')
+ monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1, google.com:6000')
assert should_bypass_proxies(url, no_proxy=None) == expected
+@pytest.mark.parametrize(
+ 'url, expected', (
+ ('http://172.16.1.1/', '172.16.1.1'),
+ ('http://172.16.1.1:5000/', '172.16.1.1'),
+ ('http://user:pass@172.16.1.1', '172.16.1.1'),
+ ('http://user:pass@172.16.1.1:5000', '172.16.1.1'),
+ ('http://hostname/', 'hostname'),
+ ('http://hostname:5000/', 'hostname'),
+ ('http://user:pass@hostname', 'hostname'),
+ ('http://user:pass@hostname:5000', 'hostname'),
+ ))
+def test_should_bypass_proxies_pass_only_hostname(url, expected, mocker):
+ """The proxy_bypass function should be called with a hostname or IP without
+ a port number or auth credentials.
+ """
+ proxy_bypass = mocker.patch('requests.utils.proxy_bypass')
+ should_bypass_proxies(url, no_proxy=None)
+ proxy_bypass.assert_called_once_with(expected)
+
+
@pytest.mark.parametrize(
'cookiejar', (
compat.cookielib.CookieJar(),
From 0813c865ee0495952c38d2b8e2932a184a1edcd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=9A=D0=BE=D0=BD?=
=?UTF-8?q?=D0=B8=D0=BD?=
Date: Thu, 18 Jan 2018 20:14:33 +0300
Subject: [PATCH 111/276] Fix broken link to Certifi
---
docs/community/recommended.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/community/recommended.rst b/docs/community/recommended.rst
index 88dcce8d..44804919 100644
--- a/docs/community/recommended.rst
+++ b/docs/community/recommended.rst
@@ -15,7 +15,7 @@ Certifi CA Bundle
validating the trustworthiness of SSL certificates while verifying the
identity of TLS hosts. It has been extracted from the Requests project.
-.. _Certifi: http://certifi.io/en/latest/
+.. _Certifi: https://github.com/certifi/python-certifi
CacheControl
------------
From 599a8f11f85349a4b71115bf9736d26305eb391c Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Sat, 20 Jan 2018 09:01:50 -0500
Subject: [PATCH 112/276] sidebar
---
docs/_templates/sidebarintro.html | 2 +-
docs/_templates/sidebarlogo.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html
index 5b437d85..c1ed8b89 100644
--- a/docs/_templates/sidebarintro.html
+++ b/docs/_templates/sidebarintro.html
@@ -30,7 +30,7 @@
-
diff --git a/docs/community/recommended.rst b/docs/community/recommended.rst
index 44804919..8fcd47a4 100644
--- a/docs/community/recommended.rst
+++ b/docs/community/recommended.rst
@@ -62,6 +62,3 @@ Betamax
A VCR imitation designed only for Python-Requests.
.. _betamax: https://github.com/sigmavirus24/betamax
-
-
-
diff --git a/docs/community/updates.rst b/docs/community/updates.rst
index f755a493..3b9a3097 100644
--- a/docs/community/updates.rst
+++ b/docs/community/updates.rst
@@ -29,4 +29,3 @@ Release and Version History
===========================
.. include:: ../../HISTORY.rst
-
diff --git a/docs/dev/todo.rst b/docs/dev/todo.rst
index 707dea31..1766a28a 100644
--- a/docs/dev/todo.rst
+++ b/docs/dev/todo.rst
@@ -62,4 +62,3 @@ Google AppEngine is not officially supported although support is available
with the `Requests-Toolbelt`_.
.. _Requests-Toolbelt: https://toolbelt.readthedocs.io/
-
diff --git a/docs/index.rst b/docs/index.rst
index 72f93b90..ae5f5c7b 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -30,8 +30,8 @@ consumption.
.. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
—*Kenneth Reitz*
-
-
+
+
-------------------
**Behold, the power of Requests**::
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst
index 1bad6435..e3ed5aa9 100644
--- a/docs/user/advanced.rst
+++ b/docs/user/advanced.rst
@@ -196,18 +196,18 @@ As a result an ``SSL: CERTIFICATE_VERIFY_FAILED`` is thrown.
You can get around this behaviour by explicity merging the environment settings into your session::
from requests import Request, Session
-
+
s = Session()
req = Request('GET', url)
-
+
prepped = s.prepare_request(req)
-
+
# Merge environment settings into session
settings = s.merge_environment_settings(prepped.url, None, None, None, None)
resp = s.send(prepped, **settings)
-
+
print(resp.status_code)
-
+
.. _verification:
SSL Cert Verification
From 22120d423e5bd5981f8e4c715d3a26071ff8d278 Mon Sep 17 00:00:00 2001
From: Semen Zhydenko
Date: Thu, 8 Feb 2018 01:25:22 +0100
Subject: [PATCH 118/276] Fix typos
nonexistant -> nonexistent
neccessary -> necessary
---
HISTORY.rst | 2 +-
requests/utils.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/HISTORY.rst b/HISTORY.rst
index 9379cbe0..61f7e232 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -131,7 +131,7 @@ dev
- Further restored the ``requests.packages`` namespace for compatibility reasons.
-No code modification (noted below) should be neccessary any longer.
+No code modification (noted below) should be necessary any longer.
2.16.1 (2017-05-27)
+++++++++++++++++++
diff --git a/requests/utils.py b/requests/utils.py
index df18a0bf..3f50d485 100644
--- a/requests/utils.py
+++ b/requests/utils.py
@@ -224,7 +224,7 @@ def guess_filename(obj):
def extract_zipped_paths(path):
- """Replace nonexistant paths that look like they refer to a member of a zip
+ """Replace nonexistent paths that look like they refer to a member of a zip
archive with the location of an extracted copy of the target, or else
just return the provided path unchanged.
"""
From 3cd87fac5d1f5a7d0cafd963c6eaea15c7139399 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Mon, 12 Feb 2018 09:42:09 -0500
Subject: [PATCH 119/276] new sidebar link
Signed-off-by: Kenneth Reitz
---
docs/_templates/sidebarintro.html | 2 +-
docs/_templates/sidebarlogo.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html
index 5b437d85..a73a7eab 100644
--- a/docs/_templates/sidebarintro.html
+++ b/docs/_templates/sidebarintro.html
@@ -30,7 +30,7 @@
From 9c0db922497bfb5827ba2e604fbcf4f02e248b8e Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Fri, 2 Feb 2018 15:49:03 -0800
Subject: [PATCH 120/276] Clarify docs that Requests always uses certs from
certifi
Since commit 0d7de6430eef0cf09f9662746daf0c28d83f144e, certifi is always
used for certificates. Certify became a hard dependency of the package
in 628633143d5b8590b1dbdf5371fe81fb8250dffd.
Now update the docs to clarify that Request will always use certificates
from certifi.
---
docs/user/advanced.rst | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst
index e3ed5aa9..f3fb45a7 100644
--- a/docs/user/advanced.rst
+++ b/docs/user/advanced.rst
@@ -274,15 +274,14 @@ If you specify a wrong path or an invalid cert, you'll get a SSLError::
CA Certificates
---------------
-By default, Requests bundles a set of root CAs that it trusts, sourced from the
-`Mozilla trust store`_. However, these are only updated once for each Requests
-version. This means that if you pin a Requests version your certificates can
-become extremely out of date.
+Requests uses certificates from the package `certifi`_. This allows for users
+to update their trusted certificates without changing the version of Requests.
-From Requests version 2.4.0 onwards, Requests will attempt to use certificates
-from `certifi`_ if it is present on the system. This allows for users to update
-their trusted certificates without having to change the code that runs on their
-system.
+Before version 2.16, Requests bundled a set of root CAs that it trusted,
+sourced from the `Mozilla trust store`_. The certificates were only updated
+once for each Requests version. When ``certifi`` was not installed, this led to
+extremely out-of-date certificate bundles when using significantly older
+versions of Requests.
For the sake of security we recommend upgrading certifi frequently!
From 265ef609d5903151374fba480aa81aafe68126ff Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Sat, 17 Feb 2018 06:15:54 -0800
Subject: [PATCH 121/276] 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.
---
docs/api.rst | 2 +-
docs/community/release-process.rst | 17 ++++++++---------
docs/user/advanced.rst | 2 +-
docs/user/quickstart.rst | 2 +-
requests/help.py | 2 +-
5 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/docs/api.rst b/docs/api.rst
index c3e00e54..ef84bf60 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -181,7 +181,7 @@ API Changes
logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
logging.getLogger().setLevel(logging.DEBUG)
- requests_log = logging.getLogger("requests.packages.urllib3")
+ requests_log = logging.getLogger("urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
diff --git a/docs/community/release-process.rst b/docs/community/release-process.rst
index 2e317ceb..18f71168 100644
--- a/docs/community/release-process.rst
+++ b/docs/community/release-process.rst
@@ -19,19 +19,18 @@ Breaking changes are changes that break backwards compatibility with prior
versions. If the project were to change the ``text`` attribute on a
``Response`` object to a method, that would only happen in a Major release.
-Major releases may also include miscellaneous bug fixes and upgrades to
-vendored packages. The core developers of Requests are committed to providing
-a good user experience. This means we're also committed to preserving
-backwards compatibility as much as possible. Major releases will be infrequent
-and will need strong justifications before they are considered.
+Major releases may also include miscellaneous bug fixes. The core developers of
+Requests are committed to providing a good user experience. This means we're
+also committed to preserving backwards compatibility as much as possible. Major
+releases will be infrequent and will need strong justifications before they are
+considered.
Minor Releases
--------------
-A minor release will not include breaking changes but may include
-miscellaneous bug fixes and upgrades to vendored packages. If the previous
-version of Requests released was ``v10.2.7`` a minor release would be
-versioned as ``v10.3.0``.
+A minor release will not include breaking changes but may include miscellaneous
+bug fixes. If the previous version of Requests released was ``v10.2.7`` a minor
+release would be versioned as ``v10.3.0``.
Minor releases will be backwards compatible with releases that have the same
major version number. In other words, all versions that would start with
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst
index f3fb45a7..e5f7f297 100644
--- a/docs/user/advanced.rst
+++ b/docs/user/advanced.rst
@@ -950,9 +950,9 @@ passed-through to `urllib3`. We'll make a Transport Adapter that instructs the
library to use SSLv3::
import ssl
+ from urllib3.poolmanager import PoolManager
from requests.adapters import HTTPAdapter
- from requests.packages.urllib3.poolmanager import PoolManager
class Ssl3HttpAdapter(HTTPAdapter):
diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst
index 1a2c6fbf..b0ff231b 100644
--- a/docs/user/quickstart.rst
+++ b/docs/user/quickstart.rst
@@ -171,7 +171,7 @@ server, you can access ``r.raw``. If you want to do this, make sure you set
>>> r = requests.get('https://api.github.com/events', stream=True)
>>> r.raw
-
+
>>> r.raw.read(10)
'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'
diff --git a/requests/help.py b/requests/help.py
index 5440ee61..06e06b2a 100644
--- a/requests/help.py
+++ b/requests/help.py
@@ -13,7 +13,7 @@ import chardet
from . import __version__ as requests_version
try:
- from .packages.urllib3.contrib import pyopenssl
+ from urllib3.contrib import pyopenssl
except ImportError:
pyopenssl = None
OpenSSL = None
From 6e76aaea4595d7c2a953fea5d624344e8c11f93a Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Thu, 22 Feb 2018 08:34:32 -0500
Subject: [PATCH 122/276] nike
Signed-off-by: Kenneth Reitz
---
docs/index.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/index.rst b/docs/index.rst
index ae5f5c7b..7934a298 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -59,7 +59,7 @@ are 100% automatic, thanks to `urllib3 `_.
User Testimonials
-----------------
-Twitter, Spotify, Microsoft, Amazon, Lyft, BuzzFeed, Reddit, The NSA, Her Majesty's Government, Google, Twilio, Runscope, Mozilla, Heroku,
+Nike, Twitter, Spotify, Microsoft, Amazon, Lyft, BuzzFeed, Reddit, The NSA, Her Majesty's Government, Google, Twilio, Runscope, Mozilla, Heroku,
PayPal, NPR, Obama for America, Transifex, Native Instruments, The Washington
Post, SoundCloud, Kippt, Sony, and Federal U.S.
Institutions that prefer to be unnamed claim to use Requests internally.
From 44dbf8cf40ef5ebf221a95680b690599548d214a Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Tue, 27 Feb 2018 08:44:29 -0500
Subject: [PATCH 123/276] updated copyright year
Signed-off-by: Kenneth Reitz
---
docs/conf.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/conf.py b/docs/conf.py
index 503448d3..c952fe79 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -58,7 +58,7 @@ master_doc = 'index'
# General information about the project.
project = u'Requests'
-copyright = u'MMXVII. A Kenneth Reitz Project'
+copyright = u'MMXVIII. A Kenneth Reitz Project'
author = u'Kenneth Reitz'
# The version info for the project you're documenting, acts as replacement for
From 06e788e253b5c05fbb1d99abfaf1e640d08727f3 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz
Date: Tue, 27 Feb 2018 09:18:00 -0500
Subject: [PATCH 124/276]
Requests is an elegant and simple HTTP library for Python, built for
human beings. You are currently looking at the documentation of the
development release.