擅长:python、mysql、java
<p>Python2.x:<a href="https://docs.python.org/2/library/httplib.html" rel="noreferrer">docs.python.org/2/library/httplib.html</a>:</p>
<blockquote>
<p>Note: HTTPS support is only available if the socket module was compiled with SSL support.</p>
</blockquote>
<p>Python3.x:<a href="https://docs.python.org/3/library/http.client.html" rel="noreferrer">docs.python.org/3/library/http.client.html</a>:</p>
<blockquote>
<p>Note HTTPS support is only available if Python was compiled with SSL support (through the ssl module).</p>
</blockquote>
<pre><code>#!/usr/bin/env python
import httplib
c = httplib.HTTPSConnection("ccc.de")
c.request("GET", "/")
response = c.getresponse()
print response.status, response.reason
data = response.read()
print data
# =>
# 200 OK
# <!DOCTYPE html ....
</code></pre>
<p>要验证是否启用了SSL,请尝试:</p>
<pre><code>>>> import socket
>>> socket.ssl
<function ssl at 0x4038b0>
</code></pre>