A simple Python Script to post from CLI

in #python4 years ago (edited)

Hello Steemit users!

We're glad to be part of your community! Looking around about programming automation from a command line , we didn't found what we were looking for : a simple script to automate the process of posting to Steemit from a shell.

AAPOD it is based on a "free" system like FreeBSD, so we need a process to schedule ad automate the daily Astronomy Picture of the Day.

Here is a simple script You can use (and eventually implement) . It is based on Steem-Python :

First Install Steem

$ pip install steem
$ git clone https://github.com/steemit/steem-python
$ cd steem-python
$ make install
steempy importaccount

Beware that u should use the BIP38 encrypted wallet, which holds your private keys.
Alternatively, you can also pass required WIF’s to Steem() initializer like in this way. For references , please consult steempy CLI to know how to set up the wallet.

from steem import Steem

s = Steem(keys=['<private_posting_key>', '<private_active_key>'])

s.commit.post(title=('titlehere'),author=('authorhere'),
body=('whatever'),
tags=('insert tag words here separated by a space'),self_vote=(True))

You can now send it to cron to automate the process! this is just a basic example, so enjoy!

Cheers
Kamakura -- AAPOD Team

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.032
BTC 59585.77
ETH 3002.01
USDT 1.00
SBD 3.78