Change the following line:
steem = Steem(wif="5yourpostingkeyhere")
to
steem = Steem(wif=os.environ['WIF_POSTING'])
Then, before you run the script, in the terminal, set the following environment variable:
export WIF_POSTING='5KDWWnSQiPtVhzCquaBWhbWS8UNoAkeNuuCm8uJJE6EiSqt514p'
(or whatever your WIF is, the above example is a worthless random key)
then run the script as normal. It will pick up the posting key from your WIF_POSTING
environment variable. Now you can save your code on GitHub or wherever else safely. :)
Actually, since the latest release of python-steem, the library also contains a wallet that can be managed through
piston
.Just import your keys with
and use
from steem import Steem
Since wif keys are stored encrypted, you will be asked to provide the password when voting. If you want to unlock the wallet from script, you can use the
UNLOCK
environmental variable:Thanks !
For the next episode I wanted to use a config file instead. :)