On Tue, Jan 10, 2017 at 08:27:21AM -0500, Donald Stufft <[email protected]>
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/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
--
https://mail.python.org/mailman/listinfo/python-list