您好,我正在使用机器人框架。
我尝试发送获取请求,但收到以下警告
C:\ Python27 \ lib \ site-packages \ urllib3-1.21.1-py2.7.egg \ urllib3 \ connectionpool.py:852:InsecureRequestWarning:正在进行未验证的HTTPS请求。强烈建议添加证书验证。请参阅:https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning)
有人有这个问题吗?在我寻找解决方案时,其中一条建议是禁用警告,但该怎么做?
先谢谢,
答案 0 :(得分:1)
以下测试用例运行完美,没有显示警告。
请注意verify=true
关键字上的Create Session
选项。
*** Settings ***
Library Collections
Library String
Library RequestsLibrary
Library OperatingSystem
*** Test Cases ***
Get Requests
[Tags] get
Create Session google http://www.google.com verify=true
Create Session github https://api.github.com verify=true
${resp}= Get Request google / timeout=5
Should Be Equal As Strings ${resp.status_code} 200
${resp}= Get Request github /users/bulkan timeout=5
Should Be Equal As Strings ${resp.status_code} 200
Dictionary Should Contain Value ${resp.json()} Bulkan Evcimen
答案 1 :(得分:0)
与verify=true
一起创建会话,默认情况下为verify=false
Create Session test_session http://www.example.com **verify=true**