I am creating a CLI using Click for accessing my API but am unsure the proper way to store the access token for the routes that require authorization. My initial thought was to store it as an environment variable, but as the CLI is not a shell or REPL and is command based the environment variable does not persist once the process dies (after the response is received and processed), so it is accessible during that command, but not accessible for any following commands.
This is my first time creating a CLI, so I’m unsure what the correct approach to this is. In researching there is a venv built into python, but that appears to be used in bash not within Python code. I can create a blank .env that ships with the library and then use the python-dotenv package to write and read to, would this be the correct approach?