From 9ffe23b172d54794462f95c3683b3601e7762ccb Mon Sep 17 00:00:00 2001 From: mengxun Date: Wed, 6 Aug 2025 16:07:15 +0800 Subject: [PATCH 1/5] Make the SSL version more human-readable --- src/requests/help.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/requests/help.py b/src/requests/help.py index 8fbcd6560a..9d43c329a3 100644 --- a/src/requests/help.py +++ b/src/requests/help.py @@ -93,9 +93,10 @@ def info(): "openssl_version": "", } if OpenSSL: + openssl_version = OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION).decode("utf-8") pyopenssl_info = { "version": OpenSSL.__version__, - "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", + "openssl_version": f"{openssl_version}", } cryptography_info = { "version": getattr(cryptography, "__version__", ""), @@ -104,8 +105,8 @@ def info(): "version": getattr(idna, "__version__", ""), } - system_ssl = ssl.OPENSSL_VERSION_NUMBER - system_ssl_info = {"version": f"{system_ssl:x}" if system_ssl is not None else ""} + system_ssl = ssl.OPENSSL_VERSION + system_ssl_info = {"version": f"{system_ssl}"} return { "platform": platform_info, From 210c679adcfff44f7daad917373b0d7882fdca83 Mon Sep 17 00:00:00 2001 From: mengxun Date: Wed, 6 Aug 2025 21:00:07 +0800 Subject: [PATCH 2/5] To improve readability, add a new key while keeping the existing one --- src/requests/help.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/requests/help.py b/src/requests/help.py index 9d43c329a3..0d599972e2 100644 --- a/src/requests/help.py +++ b/src/requests/help.py @@ -96,7 +96,8 @@ def info(): openssl_version = OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION).decode("utf-8") pyopenssl_info = { "version": OpenSSL.__version__, - "openssl_version": f"{openssl_version}", + "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", + "openssl_version_readable": openssl_version } cryptography_info = { "version": getattr(cryptography, "__version__", ""), @@ -105,8 +106,11 @@ def info(): "version": getattr(idna, "__version__", ""), } - system_ssl = ssl.OPENSSL_VERSION - system_ssl_info = {"version": f"{system_ssl}"} + system_ssl = ssl.OPENSSL_VERSION_NUMBER + system_ssl_info = { + "version": f"{system_ssl:x}" if system_ssl is not None else "", + "version_readable": ssl.OPENSSL_VERSION + } return { "platform": platform_info, From 9660d9c1e345ba0aaea56b745aa8f144af6a34d3 Mon Sep 17 00:00:00 2001 From: mengxun <30499307+mengxunQAQ@users.noreply.github.com> Date: Wed, 6 Aug 2025 21:10:32 +0800 Subject: [PATCH 3/5] Update src/requests/help.py Co-authored-by: Ian Stapleton Cordasco --- src/requests/help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/help.py b/src/requests/help.py index 0d599972e2..9cd39852de 100644 --- a/src/requests/help.py +++ b/src/requests/help.py @@ -97,7 +97,7 @@ def info(): pyopenssl_info = { "version": OpenSSL.__version__, "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", - "openssl_version_readable": openssl_version + "human_friendly_version": openssl_version, } cryptography_info = { "version": getattr(cryptography, "__version__", ""), From b748a835a6bdb1671aa0bf6da71698c754261059 Mon Sep 17 00:00:00 2001 From: mengxun <30499307+mengxunQAQ@users.noreply.github.com> Date: Wed, 6 Aug 2025 21:10:42 +0800 Subject: [PATCH 4/5] Update src/requests/help.py Co-authored-by: Ian Stapleton Cordasco --- src/requests/help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/help.py b/src/requests/help.py index 9cd39852de..263d7050e7 100644 --- a/src/requests/help.py +++ b/src/requests/help.py @@ -109,7 +109,7 @@ def info(): system_ssl = ssl.OPENSSL_VERSION_NUMBER system_ssl_info = { "version": f"{system_ssl:x}" if system_ssl is not None else "", - "version_readable": ssl.OPENSSL_VERSION + "human_friendly_version": ssl.OPENSSL_VERSION, } return { From 655e173580ca65e18ae1719241b58ea11047bbd8 Mon Sep 17 00:00:00 2001 From: mengxun Date: Wed, 13 Aug 2025 22:05:12 +0800 Subject: [PATCH 5/5] Fix the code to comply with PEP8 requirements --- src/requests/help.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/requests/help.py b/src/requests/help.py index 263d7050e7..c3b0662159 100644 --- a/src/requests/help.py +++ b/src/requests/help.py @@ -93,11 +93,11 @@ def info(): "openssl_version": "", } if OpenSSL: - openssl_version = OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION).decode("utf-8") + openssl_version = OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION) pyopenssl_info = { "version": OpenSSL.__version__, "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", - "human_friendly_version": openssl_version, + "human_friendly_version": openssl_version.decode("utf-8"), } cryptography_info = { "version": getattr(cryptography, "__version__", ""), @@ -109,7 +109,7 @@ def info(): system_ssl = ssl.OPENSSL_VERSION_NUMBER system_ssl_info = { "version": f"{system_ssl:x}" if system_ssl is not None else "", - "human_friendly_version": ssl.OPENSSL_VERSION, + "human_friendly_version": ssl.OPENSSL_VERSION, } return {