当前位置: 动力学知识库 > 问答 > 编程问答 >

python - requests.exceptions.SSLError: hostname 'boxfwd.com' doesn't match either of 'nycmsk.com', 'www.nycmsk.com'

问题描述:

Very simple example on python:

import requests

c = requests.get(u'https://boxfwd.com').content

print c

And on my local computer all works fine.

But on server I see this error:

requests.exceptions.SSLError: hostname 'boxfwd.com' doesn't match either of 'nycmsk.com', 'www.nycmsk.com'

Why I see this error on server ?

In browser I see certificate to *.boxfwd.com

网友答案:

It seems that in your server another domain (nycmsk.com) is also hosted and requests picks up that certificate.

Look here for a potential solution: http://docs.python-requests.org/en/master/community/faq/#what-are-hostname-doesn-t-match-errors

Also probably duplicate with: using requests with TLS doesn't give SNI support

网友答案:

Same type of error I was getting while integrating my HAProxy with Datadog for monitoring. Stacktrace: haproxy ------- - instance #0 [ERROR]: '(\'Connection aborted.\', BadStatusLine("\'\'",))' - Collected 0 metrics, 0 events & 0 service checks

The reason was my EC2 box url was accessible with https that causes ssl was enable.After adding 'disable_ssl_validation: true' in my haproxy.yaml in data-agent/conf.d/haproxy.yaml it worked

分享给朋友:
您可能感兴趣的文章:
随机阅读: