asyrjasalo / RESTinstance

Robot Framework library for RESTful JSON APIs
https://pypi.org/project/RESTinstance
GNU Lesser General Public License v3.0
209 stars 83 forks source link

Certificate verify failed? #3

Closed MarkJB closed 6 years ago

MarkJB commented 6 years ago

Am I right in thinking the ssl certificate verification is disabled by default?

In keywords.py

if not request['sslVerify']: disable_warnings()

I was attempting to log in to a SUT with a self signed cert and the RESTinstance library using the following:

REST.Post ${api_login} { "username": "${temp_username}", "password": "${temp_password}" }

But am seeing the following error:

SSLError: HTTPSConnectionPool(host='192.168.n.n', port=443): Max retries exceeded with url: /login (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),))

asyrjasalo commented 6 years ago

The SSL certificate verification is enabled by default.

This can be configured with the second argument in the Library import. Both Python and JSON boolean values are accepted, e.g.:

Library    REST    ${url}    ssl_verify=false
MarkJB commented 6 years ago

Thanks, that worked.

I was trying to pass the sslVerify=true/false to the 'post' keyword. Didn't think to try passing it to the library.