Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22462

Vasudev Ram: Time to Upgrade Your Python: TLS v1.2 Will Soon Be Mandatory (pyfound.blogspot.com)

$
0
0
By Vasudev Ram

Saw this blog post recently via an email from the PSF (Python Software Foundation):

Time to Upgrade Your Python: TLS v1.2 Will Soon Be Mandatory

and then also saw this HN thread (about the same post):

Time to Upgrade Your Python: TLS v1.2 Will Soon Be Mandatory (pyfound.blogspot.com)

The currently top comment in that thread, (by HN user jwilk), had examples of how to do the check for your Python's TLS version - for both Py 2 and Py 3, without using the 3rd-party requests library (which was used in the PSF post), just using Python's urllib* libraries:

From jwilk's comment:

Test procedure that doesn't require 3rd-party libs:
* For Python 2:
$ python -c "import json, urllib2; print json.load(urllib2.urlopen('https://www.howsmyssl.com/a/check'))['tls_version']"
* For Python 3:
$ python3 -c "import json, urllib.request; print(json.loads(urllib.request.urlopen('https://www.howsmyssl.com/a/check').read().decode('UTF-8'))['tls_version'])"

Tried them both out on my machine, they worked and showed the TLS version.

Speaking of one-liners, here are a few of my own, some by others, and in both Python and Unix:

Python one-liner to get the filename and line number of the caller of the current function

Python one-liner to compare two files (conditions apply)

Python one-liner to open a web site from the command line

And you can always get all the Python one-liners on my blog, both past and future [1], with this URL:

https://jugad2.blogspot.in/search/label/Python-one-liners

[1] Future one-liners, after they are written, not now :)

And the same for general one-liners (could include Python, Unix or other):

https://jugad2.blogspot.in/search/label/one-liners

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Managed WordPress Hosting by FlyWheel




Viewing all articles
Browse latest Browse all 22462

Trending Articles