From ed068ea0afbc094260c2e3e7622f60bce40c327b Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Tue, 30 May 2017 19:24:18 -0300 Subject: [PATCH] Drop python2.6 support --- .travis.yml | 7 ++----- 3.0-HISTORY.rst | 2 ++ README.rst | 2 +- docs/community/faq.rst | 3 +-- docs/dev/todo.rst | 1 - docs/index.rst | 2 +- requests/__init__.py | 7 +------ requests/adapters.py | 5 ++--- requests/utils.py | 16 +--------------- setup.py | 5 ++--- tox.ini | 4 ++-- 11 files changed, 15 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index a938f5ee..4c64b1ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ sudo: false language: python python: - - "2.6" - "2.7" - "3.3" - "3.4" @@ -14,16 +13,14 @@ python: install: "make" # command to run tests script: - - | - if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]] ; then make test-readme; fi + - make test-readme - make ci cache: pip jobs: include: - stage: test script: - - | - if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]] ; then make test-readme; fi + - make test-readme - make ci - stage: coverage python: 3.6 diff --git a/3.0-HISTORY.rst b/3.0-HISTORY.rst index 4674579a..31df0ca0 100644 --- a/3.0-HISTORY.rst +++ b/3.0-HISTORY.rst @@ -1,6 +1,8 @@ 3.0.0 (2017-xx-xx) ++++++++++++++++++ +- Support for Python 2.6 has been dropped. + - Simplified logic for determining Content-Length and Transfer-Encoding. Requests will now avoid setting both headers on the same request, and raise an exception if this is done manually by a user. diff --git a/README.rst b/README.rst index 1dbee794..13fafe4c 100644 --- a/README.rst +++ b/README.rst @@ -81,7 +81,7 @@ Requests is ready for today's web. - ``.netrc`` Support - Chunked Requests -Requests officially supports Python 2.6–2.7 & 3.3–3.7, and runs great on PyPy. +Requests officially supports Python 2.7 & 3.3–3.7, and runs great on PyPy. Installation ------------ diff --git a/docs/community/faq.rst b/docs/community/faq.rst index e835b122..256856ad 100644 --- a/docs/community/faq.rst +++ b/docs/community/faq.rst @@ -54,7 +54,6 @@ Python 3 Support? Yes! Here's a list of Python platforms that are officially supported: -* Python 2.6 * Python 2.7 * Python 3.3 * Python 3.4 @@ -69,7 +68,7 @@ These errors occur when :ref:`SSL certificate verification ` fails to match the certificate the server responds with to the hostname Requests thinks it's contacting. If you're certain the server's SSL setup is correct (for example, because you can visit the site with your browser) and -you're using Python 2.6 or 2.7, a possible explanation is that you need +you're using Python 2.7, a possible explanation is that you need Server-Name-Indication. `Server-Name-Indication`_, or SNI, is an official extension to SSL where the diff --git a/docs/dev/todo.rst b/docs/dev/todo.rst index 88f0073c..0f508caf 100644 --- a/docs/dev/todo.rst +++ b/docs/dev/todo.rst @@ -49,7 +49,6 @@ Runtime Environments Requests currently supports the following versions of Python: -- Python 2.6 - Python 2.7 - Python 3.3 - Python 3.4 diff --git a/docs/index.rst b/docs/index.rst index b17605bb..101e0450 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -104,7 +104,7 @@ Requests is ready for today's web. - Chunked Requests - ``.netrc`` Support -Requests officially supports Python 2.6–2.7 & 3.3–3.7, and runs great on PyPy. +Requests officially supports Python 2.7 & 3.3–3.7, and runs great on PyPy. The User Guide diff --git a/requests/__init__.py b/requests/__init__.py index d4461ec9..c3286724 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -100,12 +100,7 @@ from .exceptions import ( # Set default logging handler to avoid "No handler found" warnings. import logging -try: # Python 2.7+ - from logging import NullHandler -except ImportError: - class NullHandler(logging.Handler): - def emit(self, record): - pass +from logging import NullHandler logging.getLogger(__name__).addHandler(NullHandler()) diff --git a/requests/adapters.py b/requests/adapters.py index 779111d5..547d0d76 100644 --- a/requests/adapters.py +++ b/requests/adapters.py @@ -478,11 +478,10 @@ class HTTPAdapter(BaseAdapter): # Receive the response from the server try: - # For Python 2.7+ versions, use buffering of HTTP - # responses + # For Python 2.7, use buffering of HTTP responses r = low_conn.getresponse(buffering=True) except TypeError: - # For compatibility with Python 2.6 versions and back + # For Python 3.3+ versions, this is the default r = low_conn.getresponse() resp = HTTPResponse.from_httplib( diff --git a/requests/utils.py b/requests/utils.py index 3a29183e..e619bf09 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -679,22 +679,8 @@ def should_bypass_proxies(url, no_proxy): # to apply the proxies on this URL. return True - # If the system proxy settings indicate that this URL should be bypassed, - # don't proxy. - # The proxy_bypass function is incredibly buggy on OS X in early versions - # of Python 2.6, so allow this call to fail. Only catch the specific - # exceptions we've seen, though: this call failing in other ways can reveal - # legitimate problems. with set_environ('no_proxy', no_proxy_arg): - try: - bypass = proxy_bypass(netloc) - except (TypeError, socket.gaierror): - bypass = False - - if bypass: - return True - - return False + return bool(proxy_bypass(netloc)) def get_environ_proxies(url, no_proxy=None): diff --git a/setup.py b/setup.py index 93a85077..b0e7ddb5 100755 --- a/setup.py +++ b/setup.py @@ -80,7 +80,7 @@ setup( 'Natural Language :: English', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', @@ -95,7 +95,6 @@ setup( extras_require={ 'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'], 'socks': ['PySocks>=1.5.6, !=1.5.7'], - 'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'], + 'socks:sys_platform == "win32" and python_version == "2.7"': ['win_inet_pton'], }, ) - diff --git a/tox.ini b/tox.ini index 2a961c82..03f069ba 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] -envlist = py26,py27,py33,py34,py35,py36 +envlist = py27,py33,py34,py35,py36 [testenv] commands = pip install -e .[socks] - python setup.py test \ No newline at end of file + python setup.py test