title: how to get ssl certificate details using python
body: <p>I am using the following code to validate the ssl certificate status, Can we get more details about certificate like common name (CN),expiry date and issuer using request module or urllib </p>
  
  <pre><code>import requests
  
  def check_ssl(url):
      try:
          req = requests.get(url, verify=True)
          print url + ' has a valid SSL certificate!'
      except requests.exceptions.SSLError:
          print url + ' has INVALID SSL certificate!'
  
  check_ssl('https://google.com')
  check_ssl('https://example.com')
  </code></pre>