I'm on Windows 10, using python with an API token. I want to store that token as an environment variable outside of my code, then access it in python like this:
import os
token = os.environ['TOKEN_NAME']
When I set the variable as a user environment variable, I can only access it via my admin account. Ex. TOKEN_ONE in the image link below.
When I set it as a system environment variable, I can additionally access via my non-admin account. Ex. TOKEN_TWO in the image link below.
Where it says "User variables for" at the top of the below image - the blacked out portion is my admin username- and I can't change it to set to my non admin username.
My path: Control Panel ⟶ System and Security ⟶ System ⟶ Advanced System Settings (asks for admin password) ⟶ Environment Variables
Environment Variables Settings
Is there a way to make a user environment variable, accessible from a user account, that is not system wide?
By accessible, I mean it shows up when I type set
into terminal.
My use case doesn't necessarily need it to be local to the user, but it would be good to know how to do that if possible.
If not, I will learn more about virtual environments.
Thank you.