I'm using the very good Click framework to build a Python CLI that acts as a "wrapper" around a set of complex REST APIs. I've used the "complex" example in order to have good boilerplate code to build the rest of CLI.
However, since the CLI itself communicates with REST APIs, I need a bit of configuration for each command. Example: user authentication (id, password, etc.), and, if different from the default one, the URL to API server.
I could force the user to put these configuration as parameters for each command, but this would be really annoying when executing many commands (the user has to insert his auth details for every command).
Is there a way to have the user enter his credentials at the first command in order to have his uid/pwd persist for the entire session (like the mysql-cli, for example), and, after executing the commands he needed, "logout" from the CLI?