@jeremycherfas an easy way to remove the hard-coded credentials from code you want to share, is to pass them as environmental variables. So for example password = "some_pw"
can become password = os.environ["SCRIPT_PASSWORD"]
, by importing the os
library.
An easy way to set environmental variables without having to tinker too much in your OS of choice, is to use a .env
file and just load it from your script. Just make sure you don't share the .env
file together with the code (by e.g. adding it to a .gitignore
file if you are using git -> github to share the code).
@giov Thanks for those tips.