Requests library - Masking API key

Hello,

I’m trying to find a solution on how to mask the e.g. an API key from the output files that RF generates (output.xml, log.html, report.html).

By default, RF logs the password in text to the output files, I discovered that if I run the robot with “robot -L none test.robot” option, it does not record the password as text.

Question is that is there any other way of masking sensitive information from the output files?
My concern is that the level of logging can easily be changed from ‘none’ to something else from the test execution command.

Working with e.g. RPA.browser.selenium there is a keyword “Input password” that seems to change the logging level temporally. I’m looking for something similiar when working with requests.

Example on a GET request where I pass in an api key in the header:

APITEST_GET
    Create Session    GetSomething    https://something.api.com
    ${params}    Create Dictionary    SubscriptionKey=${ApiKey}
    ${Get_Response}=    GET On Session    GetSomething    /GetTest/Test     headers=${params}

Any help is highly appreciated.

Hi

Could you just not wrap Set Log Level around those lines or any as seen below:

 APITEST_GET
       Set Log Level    NONE
       # You're lines
       Set Log Level    INFO
1 Like

Hi,

This seems to be working just fine!
I swear that I tried this earlier, only to receive something in line with that I could not change the log level during a running test…

Thank you _daryl!

1 Like