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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content