From f6e07bb27f9fe092dabb1945ef7fd515db7870fe Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Mon, 3 Jul 2017 17:21:56 -0600 Subject: [PATCH 01/12] fix OPENSSL_VERSION_NUMBER check on Python2.6's ssl module --- requests/help.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/requests/help.py b/requests/help.py index 695b5ee2..cd961c78 100644 --- a/requests/help.py +++ b/requests/help.py @@ -85,12 +85,16 @@ def info(): 'version': getattr(cryptography, '__version__', ''), } + # OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module. + system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None) + system_ssl_info = { + 'version': '%x' % system_ssl if system_ssl is not None else '' + } + return { 'platform': platform_info, 'implementation': implementation_info, - 'system_ssl': { - 'version': '%x' % ssl.OPENSSL_VERSION_NUMBER, - }, + 'system_ssl': system_ssl_info, 'using_pyopenssl': pyopenssl is not None, 'pyOpenSSL': pyopenssl_info, 'urllib3': urllib3_info, From 51feabbc27821c5acb7f0ceb932d19c0d79f16d1 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Mon, 3 Jul 2017 17:41:53 -0600 Subject: [PATCH 02/12] test ssl version check functions as expected in python 2.6 --- tests/test_help.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_help.py diff --git a/tests/test_help.py b/tests/test_help.py new file mode 100644 index 00000000..f08fdd97 --- /dev/null +++ b/tests/test_help.py @@ -0,0 +1,21 @@ +# -*- encoding: utf-8 + +import sys + +import pytest + +from requests.help import info + + +@pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6") +def test_system_ssl_py26(): + """OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't + blow up in this case. + """ + assert info()['system_ssl'] == {'version': ''} + + +@pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+") +def test_system_ssl(): + """Verify we're actually setting system_ssl when it should be available.""" + assert info()['system_ssl']['version'] != '' From 14176d1d63b6a85308fd61a9a20c8aeed398043b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 6 Jul 2017 17:57:28 -0400 Subject: [PATCH 03/12] no more stickers --- docs/_templates/sidebarintro.html | 5 ----- docs/_templates/sidebarlogo.html | 6 ------ 2 files changed, 11 deletions(-) diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html index 02d07f47..f840e9ef 100644 --- a/docs/_templates/sidebarintro.html +++ b/docs/_templates/sidebarintro.html @@ -16,11 +16,6 @@ -

Stickers!

- - -Order Stickers! -

Stay Informed

Receive updates on new releases and upcoming projects.

diff --git a/docs/_templates/sidebarlogo.html b/docs/_templates/sidebarlogo.html index 09ad797b..fba676f1 100644 --- a/docs/_templates/sidebarlogo.html +++ b/docs/_templates/sidebarlogo.html @@ -23,12 +23,6 @@ -

Stickers!

- - -Order Stickers! - -

If you enjoy using this project, Say Thanks!