Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CertificateError: hostname doesn't match

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' 

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.

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.

like image 690
pugmastaflex Avatar asked Feb 27 '15 15:02

pugmastaflex


1 Answers

You can avoid this error by monkey patching ssl:

import ssl
ssl.match_hostname = lambda cert, hostname: True
like image 138
hoju Avatar answered Oct 14 '22 02:10

hoju