3 ms·
In addition to the steps mentioned above, one thing that has kept me safe from my own heedlessness is to never, ever store credentials in a source code tree. I
by theGimp 12y ago
In addition to the steps mentioned above, one thing that has kept me safe from my own heedlessness is to never, ever store credentials in a source code tree.
If your project is reading credentials from a file, rewrite it so it reads them from environment variables.
Most IDEs make it very easy to do that, and Python's virtual environments can do that work for you. Yes, it takes more effort, and sometimes it will be a little convoluted[1].
However, it's well worth the effort as you will have a system that you can put your faith in rather than having to double check every time in order to make sure you're not about to inadvertently commit your API keys.
[1] Example of my own: Pycharm does not read variables stored in a virtual environment's configuration, so I have to set them twice.