Monday 24 July 2017

How to get the TLS version of request being made by python code?


Python TLS request version

 
# pyhton 2
python -c "import json, urllib2;\
 print json.load(urllib2.urlopen('https://www.howsmyssl.com/a/check'))['tls_version']"


# pyhton 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'])"

How to get openssl version in python

Python get openSSL version



>>> from OpenSSL import SSL
print(SSL.OPENSSL_VERSION_NUMBER)