问题遇到的现象和发生背景
在postman上可以正常获取token值,但在ipython上运行就报错。
postman上的响应消息体:
{
"retCode": "0000",
"retMsg": "成功",
"token": "07D93C0330F946F19E5DFFDFFF28D90B"
}
代码
import requests
import json
url = "https://netplus.raymond.net.cn:9095/NetPlus/httpIfs3rd/token"
payload = json.dumps({
"key": "ilTXSK1Wwe + m4r2M35V2YzoKUzLYLh6RAWIH32rA2LU66KKhiB + ojR6eLlYhiu5gfoFOzx + x8N + Oow5paZ0fkthZBzguUS7UI3yhFbQWCw9gzCc9RmUrB52wHyqAfflwKAz81xCE8S9ei5BjAsLE7sew88V1WmsWi62Mbufw =",
"code": "0001"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
运行结果及报错内容
SSLError: HTTPSConnectionPool(host='netplus.raymond.net.cn', port=9095): Max retries exceeded with url: /NetPlus/httpIfs3rd/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1123)')))
我的解答思路和尝试过的方法
安装几个requests依赖包,但仍然报同样的错误信息。
pip install cryptography
pip install pyOpenSSL
pip install certifi
我想要达到的结果
期望指点,解决此错误。