title: How to import OpenSSL in python
body: <p>I am trying to run this simple code to retrieve SSL certificate:</p>
  
  <pre><code>import ssl, socket
  
  #print ssl.get_server_certificate(('www.google.com', 443))
  cert=ssl.get_server_certificate(('www.google.com', 443))
  # OpenSSL
  x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert)
  x509.get_subject().get_components()
  </code></pre>
  
  <p>But I get error saying:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\e\Desktop\Python\ssl\test.py", line 6, in &lt;module&gt;
      x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert)
  NameError: name 'OpenSSL' is not defined
  </code></pre>
  
  <p>I am aware that I have to import OpenSSL. But I do not know how? and where to get the OpenSSL from? 
  I downloaded a module called pyOpenSSL from <a href="https://pypi.python.org/pypi/pyOpenSSL" rel="noreferrer">https://pypi.python.org/pypi/pyOpenSSL</a>
  Which contains two folders: pyOpenSSL-0.15.1.dist-info and OpenSSL.
  When I tried to add import OpenSSL or import pyOpenSSL I get errors. 
  Can you explain clearly please, how to import these libraries or modules? where they should be placed? if not in the same directory of my code file? how to write the path in the import syntax??
  Please, help. </p>
  
  <p><strong>EDIT:</strong>
  when tried to add <code>from OpenSSL import SSL</code> in the code, I got:</p>
  
  <pre><code>    C:\Users\e\Desktop\Python\ssl&gt;test.py
  Traceback (most recent call last):
    File "C:\Users\e\Desktop\Python\ssl\test.py", line 2, in &lt;module&gt;
      from OpenSSL import SSL
    File "C:\Users\e\Desktop\Python\ssl\OpenSSL\__init__.py", line 8, in &lt;module&gt;
      from OpenSSL import rand, crypto, SSL
    File "C:\Users\e\Desktop\Python\ssl\OpenSSL\rand.py", line 9, in &lt;module&gt;
      from six import integer_types as _integer_types
  ImportError: No module named six
  </code></pre>