from steem import Steem

import time, random, os, json, sys

def buy_upvote(author,upvote_bot, amount, permlink):
transfers =[{
'from': author,
'to': upvote_bot,
'amount': '{0:.3f} SBD'.format(amount),
'memo': 'https://steemit.com/@{}/{}'.format(author, permlink)
}]
tb = TransactionBuilder()
operation = [operations.Transfer(**x) for x in transfers]
tb.appendOps(operation)
tb.appendSigner(author, 'active')
tb.sign()

try:
    tx = tb.broadcast()
    print ("Buying vote succes")
except Exception as error:
    print(repr(error))

def submit_post(title, tags, body, author, upvote_weight):
steemPostingKey = os.environ.get('steemPostingKey')
steem = Steem(wif=steemPostingKey)

permlink_title = ''.join(e for e in title if e.isalnum()).lower()
permlink = "{}-%s%s".format(permlink_title) % (time.strftime("%Y%m%d%H%M%S"), random.randrange(0,9999,1))

try:
    steem.post(title, body, author, permlink, None, None, None, None, tags, None, False)
    #steem.vote('@{}/{}'.format(author,permlink), upvote_weight, author)
    print ("Submitted post")
except Exception as error:
    print(repr(error))

return permlink

def run():
author = 'sttest1'
upvote_bot = 'minnowbooster'
amount = 0.05

filename = sys.argv[-1]

lines = open(filename).readlines()
lines = [l.replace("\n", "") for l in lines]

title, tags, upvote_weight, body = (
    lines[0],
    lines[1],
    lines[2],
    "\n".join(lines[3:])
)

permlink = submit_post(
    title, tags, body, author, upvote_weight)

#buy_upvote(author, upvote_bot, amount, permlink)

if name == 'main':
run()

Coin Marketplace

STEEM 0.28
TRX 0.13
JST 0.033
BTC 62414.94
ETH 3019.57
USDT 1.00
SBD 3.58