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

in STEEM CN/中文8 months ago

steem-python :is Steem the official Python library, has a bip38 encryption wallet and a practical cli utility(steempy).
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 = [
custom_instance = Steemd(nodes=steemd_nodes)

tmpAccount = Account('dappcoder', steemd_instance=custom_instance)
print('tmpAccount:', tmpAccount)
tmpBlockchain = Blockchain(mode='head', steemd_instance=custom_instance)
print('tmpBlockchain:', tmpBlockchain)

run it:python dynamic_nodes.py



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!



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

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



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