Announcement: TLSv1.2 will become mandatory in the future for Python.org Sites

Oleg Broytman phd at phdru.name
Tue Jan 10 09:59:45 EST 2017


On Tue, Jan 10, 2017 at 08:27:21AM -0500, Donald Stufft <donald at python.org> wrote:
>     python3 -c "import urllib.request,json; print(json.loads(urllib.request.urlopen('https://www.howsmyssl.com/a/check').read())['tls_version'])"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.4/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

   Fix:

$ python3 -c "import urllib.request,json; print(json.loads(urllib.request.urlopen('https://www.howsmyssl.com/a/check').read().decode('ascii'))['tls_version'])"

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-list mailing list