本文介绍了CertificateError:主机名不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用代理服务器(位于公司防火墙后)登录到https域. SSL握手似乎不太顺利:

I'm using a proxy (behind corporate firewall), to login to an https domain. The SSL handshake doesn't seem to be going well:

CertificateError: hostname 'ats.finra.org:443' doesn't match 'ats.finra.org'

我正在使用Python 2.7.9-Mechanize,并且已经超越了所有的登录名,密码,安全问题屏幕,但是它却挂在了证书上.

I'm using Python 2.7.9 - Mechanize and I've gotten past all of the login, password, security questioon screens, but it is getting hung up on the certification.

任何帮助都将是惊人的.我尝试了在这里找到的Monkeywrench:强制机械化以使用SSLv3

Any help would be amazing. I've tried the monkeywrench found here: Forcing Mechanize to use SSLv3

虽然不适用于我的代码.

Doesn't work for my code though.

如果您想要代码文件,我很乐意发送.

If you want the code file I'd be happy to send.

推荐答案

您可以通过猴子修补ssl来避免此错误:

You can avoid this error by monkey patching ssl:

import ssl
ssl.match_hostname = lambda cert, hostname: True

这篇关于CertificateError:主机名不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 03:41