let the official steem-python be as easy to use as beem? Dynamically search for available steem API nodes

in STEEM CN/中文5 years ago

steem-python :is Steem the official Python library, has a bip38 encryption wallet and a practical cli utility(steempy).
0.jpg
However, for many Chinese users, the pain is that the official steem API node is often inaccessible.

The advantage of beem is that it can automatically find the available steem API nodes. Most of the time, you don't need to worry about network access.

So how to make the official steem-python as easy to use as beem? We can also try to use the function of dynamic switching the steem API node in the steem-python program.

Dynamically switch the stem API node

Demonstration program (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)

run it:python dynamic_nodes.py

Sort:  

!great
!shop

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

You received more than 10 as payout for your posts. Your next target is to reach a total payout of 50

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!

你好鸭,dappcoder!

@chinesebi给您叫了一份外卖!

@xiaoyuanwmm 村凤 在艳阳高照 骑着共享单车 给您送来
桃酥饼

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~
@onepagex

剪刀


It’s a tie! 平局!想不到你也出鸡爪!

这是为何

不可描述的原因比较多.