python - How can I hide sensitive data before commiting to GitHub (or any other Git repo)? -
i'm creating code demonstrate how consume rest service in python, don't want api keys visible people when push changes github. how can hide such information?
if you’re using python, might consider using keyring
module. allows store secret information in system keychain, , there’s no risk accidentally checked git.
here’s simple example storing , retrieving api key, based on docs:
>>> import keyring >>> keyring.set_password("my_api_key", "username", "abc1234sekrit") >>> keyring.get_password("my_api_key", "username") 'abc1234sekrit'
Comments
Post a Comment