steem-python :是 Steem 官方的 Python 库Steem Python,有一个BIP38加密钱包和一个实用的CLI实用程序 steempy。
但是,很多对于中文用户来说,痛苦的事,steem 官方 API 节点,经常不可访问.
beem的好处是,可以自动寻找可用的 steem 服务器节点,大多数时候,不用担心网络访问的问题.
那么如何让 官方的 steem-python 像 beem 一样 好用? 我们也可尝试在 steem-python 的程序中,使用动态切换 steem API 节点的功能.
动态切换 steem API 节点
示范程序(dynamic_nodes.py):
import steembase
import steem
from steem.steemd import Steemd
from steem.account import Account
from steem.blockchain import Blockchain
steemd_nodes = [
'https://anyx.io',
'https://steemd.minnowsupportproject.org',
'https://rpc.esteem.app',
'https://api.steemit.com',
'https://api.steem.house',
'https://gtg.steem.house:8090',
'https://appbasetest.timcliff.com',
]
custom_instance = Steemd(nodes=steemd_nodes)
tmpAccount = Account('dappcoder', steemd_instance=custom_instance)
print('tmpAccount:', tmpAccount)
print('')
tmpBlockchain = Blockchain(mode='head', steemd_instance=custom_instance)
print('tmpBlockchain:', tmpBlockchain)
执行程序:python dynamic_nodes.py