擅长:python、mysql、java
<p>我的一些脚本在更新计算机后停止工作。结果,这就是问题所在:<a href="https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection" rel="noreferrer">https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection</a></p>
<blockquote>
<p>Changed in version 2.7.9: context was added.</p>
<p>This class now performs all the necessary certificate and hostname checks by default. To revert to the previous, unverified, behavior ssl._create_unverified_context() can be passed to the context parameter.</p>
</blockquote>
<p>因此,如果您的Python版本是>;=2.7.9(在我的例子中是2.7.10),您可能会遇到这种情况。为了解决这个问题,我更新了我的电话:</p>
<pre><code>httplib.HTTPSConnection(hostname, timeout=5, context=ssl._create_unverified_context())
</code></pre>
<p>这可能是保持相同行为的最简单的更改。</p>