2

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'",),))

kalehmann
  • 4,821
  • 6
  • 26
  • 36
Mikko
  • 31
  • 1
  • 3
  • and when I try to open this URL using Google Chrome, it says"Your connection is not private Attackers might be trying to steal your information from gss.mof.gov.cn (for example, passwords, messages, or credit cards). " – Mikko Aug 29 '19 at 12:48
  • I added headers in the request but still doesn't work. I used verify=False but got 403 Error – Mikko Aug 29 '19 at 13:19
  • Solved, it turned out that I should use 'http' instead of 'https' in the url. pretty stupid mistake – Mikko Aug 30 '19 at 00:45

1 Answers1

0

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.

doneal24
  • 101
  • 1
  • 2