파이썬 beem을 이용한 포스팅 - 커뮤니티 포스트

파이썬 beem을 이용해서 특정 커뮤니티에 포스팅하는 방법입니다. 기본적으로 블로그 포스트와 거의 비슷하며, 어느 커뮤니티에 포스팅할 것인지를 parent permlink를 이용해서 지정합니다.

파이썬 beem을 이용한 블로그 포스트는 아래의 링크를 참고하시기 바랍니다.

파이썬 beem을 이용한 포스팅 - 블로그 포스트

블로그 포스트에서는 첫번째 태그(tag)를 parent permlink로 지정했지만, 커뮤니티 포스트에서는 커뮤니티 식별자를 지정합니다. 커뮤니티 식별자는 "hive-[번호]" 형식이며, 커뮤니티 접속 URL에서 확인할 수 있습니다.

예를 들어 "NOTICE & AutoVoting" 커뮤니티는 아래의 링크로 접속할 수 있습니다.

https://steemit.com/created/hive-141029

이 경우 커뮤니티 식별자는 hive-141029입니다. 이 커뮤니티에 포스팅을 한다면 아래의 코드처럼 할 수 있겠습니다. parent_permlink를 제외한 나머지 부분은 사실상 블로그 포스트와 동일합니다.

import json
from beem import Steem
from beembase.operations import Comment
from beem.transactionbuilder import TransactionBuilder

node_list = ["https://api.steemit.com"]
steem = Steem(node=node_list)

steem_id = 'joviansummer'
posting_key = '5XXXX...'

community_id = 'hive-141029'

author = steem_id
permlink = 'my-community-post-with-python-beem-test'
title = '시험용 포스트 (커뮤니티)'
body = '이것은 시험용 포스트입니다.\n커뮤니티 포스트입니다.'
tag_list = ['test','beem']
metadata = {"tags":tag_list}
parent_author = ''
parent_permlink = community_id

# 포스트 전송
tx = TransactionBuilder(blockchain_instance=steem)
tx.appendOps(Comment(**{"parent_author": parent_author,  "parent_permlink": parent_permlink, "author": author, "permlink": permlink, "title": title, "body":body, "json_metadata": json.dumps(metadata)}))
tx.appendWif(posting_key)
signed_tx = tx.sign()
broadcast_tx = tx.broadcast(trx_id=True)

@joviansummer의 스팀 프로젝트

스팀 증인노드를 운영중입니다. @jswit에 증인투표해 주시면 감사하겠습니다.
(https://steemitwallet.com/~witnesses)

jswit 증인 노드 프로젝트를 시작합니다.

jsup 업보팅(upvoting) 서비스 소개

jsup 수혜자 지정 기능 추가

jSTEEM 프로젝트 - 텔레그램 챗봇으로 구현하는 스팀 블럭체인 탐색기

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 61651.16
ETH 2369.36
USDT 1.00
SBD 2.50