[Python] Storing REST API credentials safely for access in a Python environment

Discussão em 'Python' iniciado por Stack, Janeiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    I have a number of REST APIs from a software program (ex: Tradingview)

    I would like to store the API credentials (e.g. keys, secrets) safely.

    I had thought about placing them in a Database table - but - I am not totally fond of placing clear text in a table.

    I already know about using OS Environment Variables:

    [... snip ...]

    import os
    import sys
    import logging

    [... snip ...]

    LD_API_KEY = os.getenv("BINANCE_APIKEY")
    LD_API_SECRET = os.getenv("BINANCE_API_SECRET")


    where keys are stored in a file - but - as mentioned before, I have a number of API keys.

    Just leaving them on a server (in clear text) - even though the file is hidden - is not sitting well with me.

    Is there any other way to store API Keys?

    Continue reading...

Compartilhe esta Página