InsecureRequestWarning: Unverified HTTPS request is being made to host

trying to execute POST method but getting error

robot -d results .\APIs\TC1_GET_Request.robot

TC1 GET Request

Get_User_Info .C:\Users\Dell\AppData\Local\Programs\Python\Python312-32\Lib\site-packages\urllib3\connectionpool.py:1103: InsecureRequestWarning: Unverified HTTPS request is being made to host ‘reqres.in’. Adding certificate verification is strongly advised. See: Advanced Usage - urllib3 2.2.2 documentation
warnings.warn

My script is

*** Settings ***
Library RequestsLibrary
Library Collections

*** Variables ***
#Run the script
#robot -d results .\APIs\TC1_GET_Request.robot
${base_url} https://reqres.in/

*** Test Cases ***
CreateUser_Post
Create Session mysession ${base_url} disable_warnings=1
${body}= Create Dictionary name=ajaybodake job=SSE
${header}= Create Dictionary Content-Type=application/json
${response}= POST On Session mysession /api/users data=${body} headers=${header}
… verify=False

Log To Console    ${response.status_code}
Log To Console    ${response.content}

#Validations
 ${status_code}=    Convert To String      ${response.status_code}
 Should Be Equal    ${status_code}    201
${res_body}=    Convert To String    ${response.content}
Should Contain    ${res_body}    SSE

Hi Ajay,

Normally you get an error like this when your test environment is setup with a self signed certificate or when there is some other issue causing the certificate not to be recognised as a valid cert. (It happened a lot a few years back when one of the top level cert signing authorities had to quickly change a root cert)

The easiest solution is to get your IT people to ensure the certs are setup and signed correctly, but if that’s not an easy option, there are a couple of setting for Create Session that you should look into, namely verify and disable_warnings, don’t just blindly go changing them, take time to understand the consequences and risks first.

Dave.