# Requests library - Masking API key

**URL:** <https://forum.robotframework.org/t/requests-library-masking-api-key/6710>\
**Category:** RequestsLibrary\
**Created:** [24 January 2024 12:23 UTC](https://forum.robotframework.org/t/requests-library-masking-api-key/6710 "2024-01-24T12:23:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Recodi](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/recodi/32/3388_2.png) [@Recodi](https://forum.robotframework.org/u/Recodi)\
**Post date:** [24 January 2024 12:23 UTC](https://forum.robotframework.org/t/requests-library-masking-api-key/6710/1 "2024-01-24T12:23:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [26 January 2024 09:13 UTC](https://forum.robotframework.org/t/requests-library-masking-api-key/6710/2 "2024-01-26T09:13:13Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![Recodi](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/recodi/32/3388_2.png) [@Recodi](https://forum.robotframework.org/u/Recodi)\
**Post date:** [26 January 2024 10:18 UTC](https://forum.robotframework.org/t/requests-library-masking-api-key/6710/3 "2024-01-26T10:18:32Z")

</div>

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!
