昆明网站建设昆明,怎么做公司的网站,网站设计开发维护,嵌入式培训宣传用requests包请求https的网站时#xff0c;我们偶尔会遇到证书问题。也就是常见的SSLerror#xff0c;遇到这种问题莫慌莫慌。这里没有找到合适的网站去报SSL证书的错误#xff0c;所以就假装请求了一个https的网站#xff0c;然后给报了SSLerror了#xff0c;然后下面是解…用requests包请求https的网站时我们偶尔会遇到证书问题。也就是常见的SSLerror遇到这种问题莫慌莫慌。这里没有找到合适的网站去报SSL证书的错误所以就假装请求了一个https的网站然后给报了SSLerror了然后下面是解决方法可以直接关闭验证ssl证书import requests:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.:param verify: (optional) Either a boolean, in which case it controls whether we verifythe servers TLS certificate, or a string, in which case it must be a pathto a CA bundle to use. Defaults to True.r requests.get(https://kyfw.12306.cn,verifyFalse)print(r.text)这种方式直接在函数里面加如verify改变Ture或者False即可因为post与get调用的都为request()函数所以get与post都一样。如果这种方式奏效就用这种方式如果不奏效就用下面的一种import requests:param verify: (optional) Either a boolean, in which case it controls whether we verifythe servers TLS certificate, or a string, in which case it must be a pathto a CA bundle to use. Defaults to True.## 证书路径cert ../cert/test.pemr requests.get(https://kyfw.12306.cn,verifycert)print(r.text)就用这种直接把证书的路径丢给verify请求即可以上就是本文的全部内容希望对大家的学习有所帮助也希望大家多多支持我们。本文标题: python requests证书问题解决本文地址: http://www.cppcns.com/jiaoben/python/272431.html