如让官方的 steem-python 像 beem 一样 好用?动态寻找可用的 steem API 节点

avatar
(Edited)

steem-python :是 Steem 官方的 Python 库Steem Python,有一个BIP38加密钱包和一个实用的CLI实用程序 steempy。
屏幕快照 2020-01-31 下午5.16.37.png
但是,很多对于中文用户来说,痛苦的事,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



0
0
0.000
2 comments
avatar

Congratulations @dappcoder! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You distributed more than 400 upvotes. Your next target is to reach 500 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!
0
0
0.000