requests.exceptions.SSLError: 主机名“boxfwd.com”与“nycmsk.com”、“www.nycmsk.com”中的任何一个都不匹配

dhy*_*sba 6 python ssl https python-requests

非常简单的python示例:

import requests

c = requests.get(u'https://boxfwd.com').content
print c
Run Code Online (Sandbox Code Playgroud)

在我的本地计算机上一切正常。

但是在服务器上我看到这个错误:

requests.exceptions.SSLError: hostname 'boxfwd.com' doesn't match either of 'nycmsk.com', 'www.nycmsk.com'
Run Code Online (Sandbox Code Playgroud)

为什么我在服务器上看到这个错误?

在浏览器中,我看到 *.boxfwd.com 的证书 证书

mil*_*tos 1

看来您的服务器中还托管了另一个域(nycmsk.com)并requests获取该证书。

在这里寻找潜在的解决方案:https://2.python-requests.org/en/master/community/faq/#what-are-hostname-doesn-t-match-errors

也可能重复:使用带有 TLS 的请求不提供 SNI 支持