python: ssl.get_server_certificate() returns unicode type in Red Hat Enterprise Linux 7.2

Solution Verified - Updated -

Issue

  • python: ssl.get_server_certificate() returns unicode type in Red Hat Enterprise Linux 7.2
  • On RHEL7.1 ssl.get_server_certificate() returns a string object.
  • On RHEL7.2 the same function returns a unicode object.
[user@localhost ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.1 (Maipo)
[user@localhost ~]$ python <<< "import ssl; print type(ssl.get_server_certificate(('<REDACTED>', 443)))"
<type 'str'>

[user@localhost ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[user@localhost ~]$ python <<< "import ssl; print type(ssl.get_server_certificate(('<REDACTED>', 443)))"
<type 'unicode'>

Environment

  • Red Hat Enterprise Linux 7.2
  • python-2.7.5-34.el7.x86_64

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.