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.

<p dir="auto">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. <p dir="auto">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. <h2>Dynamically switch the stem API node <p dir="auto">Demonstration program (dynamic_nodes.py): <pre><code>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) <p dir="auto">run it:<code>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) :

<table><tr><td><img src="https://images.hive.blog/768x0/https://steemitimages.com/60x70/http://steemitboard.com/@dappcoder/payout.png?202002010537" srcset="https://images.hive.blog/768x0/https://steemitimages.com/60x70/http://steemitboard.com/@dappcoder/payout.png?202002010537 1x, https://images.hive.blog/1536x0/https://steemitimages.com/60x70/http://steemitboard.com/@dappcoder/payout.png?202002010537 2x" /><td>You received more than 10 as payout for your posts. Your next target is to reach a total payout of 50 <p dir="auto"><sub><em>You can view <a href="https://steemitboard.com/@dappcoder" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">your badges on your Steem Board and compare to others on the <a href="https://steemitboard.com/ranking/index.php?name=dappcoder" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Steem Ranking<br /> <sub><em>If you no longer want to receive notifications, reply to this comment with the word <code>STOP <p dir="auto">To support your work, I also upvoted your post! <h6><a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Vote for @Steemitboard as a witness to get one more award and increased upvotes!

你好鸭,dappcoder!

@chinesebi给您叫了一份外卖!


桃酥饼

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~@xiaoyuanwmm 村凤 在艳阳高照 骑着共享单车 给您送来

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

剪刀


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

这是为何

不可描述的原因比较多.