我正在编写一个涉及CAS,jspring安全检查,重定向等的简单脚本.我想使用Kenneth Reitz的python请求,因为它是一项很棒的工作!但是,CAS需要通过SSL进行验证,因此我必须先通过该步骤.我不知道Python的要求是什么?这个SSL证书应该驻留在哪里?
Traceback (most recent call last):
File "./test.py", line 24, in <module>
response = requests.get(url1, headers=headers)
File "build/bdist.linux-x86_64/egg/requests/api.py", line 52, in get
File "build/bdist.linux-x86_64/egg/requests/api.py", line 40, in request
File "build/bdist.linux-x86_64/egg/requests/sessions.py", line 209, in request
File "build/bdist.linux-x86_64/egg/requests/models.py", line 624, in send
File "build/bdist.linux-x86_64/egg/requests/models.py", line 300, in _build_response
File "build/bdist.linux-x86_64/egg/requests/models.py", line 611, in send
requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Run Code Online (Sandbox Code Playgroud) 这应该是一件容易的事情.我可以在Guzzle 3中找到很多关于如何操作的参考资料,但它们在Guzzle 5中不起作用.
到目前为止我在做什么:
$this->client = new GuzzleClient(['defaults' => [
'verify' => 'false'
]]);
Run Code Online (Sandbox Code Playgroud)
当我发送请求时,我收到此错误:
RequestException in RequestException.php line 51:
SSL CA bundle not found: false
Run Code Online (Sandbox Code Playgroud)
我在谷歌上找不到任何有用的参考这个错误.如果我可以访问curl选项,那么我可以尝试类似这里建议的解决方案(适用于Guzzle 3,因此它不起作用):http://inchoo.net/dev-talk/symfony2-guzzle -ssl-self-signed-certificate /,其相关部分是:
$req->getCurlOptions()->set(CURLOPT_SSL_VERIFYHOST, false);
$req->getCurlOptions()->set(CURLOPT_SSL_VERIFYPEER, false);
Run Code Online (Sandbox Code Playgroud)