有时候,有这么一种场景。https接口有SSL证书, 但访问的客户端不能联网验证证书,也不能本地存储证书。
在Python中, 大概如下处理:
verify设置为 False,Requests 能忽略对 SSL 证书的验证。
rs =requests.session()
r= rs.get(url, params=data, timeout=(3,7), verify=False)
C#中,
HttpClientHandler handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback=(message,cert,chain,errors)=>{return true;},
// 忽略tls1.2
}
HttpClient httpClient = new HttpClient(handler);
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12;
原创文章,作者:Gary,如若转载,请注明出处:https://www.cpw5.top/81.html
淘宝小店:陈皮王五工作室