简体   繁体   中英

SSLError:CertificateError: hostname doesn't match

I tried to access this website https://gss.mof.gov.cn/zhengwuxinxi/zuixingengxin/ with Pythons request library and got a SSL error.

I have already tried the solutions given for similar problems but they did not solve my problem.

The code I used:

requests.get(url='https://gss.mof.gov.cn/zhengwuxinxi/zuixingengxin/', timeout=20)

The error I got:

HTTPSConnectionPool(host='gss.mof.gov.cn', port=443): Max retries exceeded with url: /zhengwuxinxi/zuixingengxin/ (Caused by SSLError(CertificateError("hostname 'gss.mof.gov.cn' doesn't match either of '*.chinacache.com', 'chinacache.com'",),))

The site is using a certificate that doesn't belong to it. openssl s_client confirms that the certificate is valid for *.chinacache.com . No amount of finagling with the python settings will make the connection to the site secure. The owners of the site will have to get a new certificate matching the site's host name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM