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

View this thread on steempeak.com
· @dappcoder · (edited)
$0.83
如让官方的 steem-python 像 beem 一样 好用?动态寻找可用的 steem API 节点
[steem-python](https://github.com/steemit/steem-python) :是 [Steem](https://steem.io) 官方的 Python 库Steem Python,有一个BIP38加密钱包和一个实用的CLI实用程序 steempy。
![屏幕快照 2020-01-31 下午5.16.37.png](https://cdn.steemitimages.com/DQmVFWvmtep5HzRpRZPusEAVf8BedyM574WX8YARR9WFsDC/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202020-01-31%20%E4%B8%8B%E5%8D%885.16.37.png)
但是,很多对于中文用户来说,痛苦的事,steem 官方 API 节点,经常不可访问.

beem的好处是,可以自动寻找可用的 steem 服务器节点,大多数时候,不用担心网络访问的问题.

那么如何让 官方的  steem-python 像 beem 一样 好用? 我们也可尝试在 steem-python 的程序中,使用动态切换   steem API 节点的功能.

动态切换   steem API 节点
-----------------------------
示范程序(dynamic_nodes.py):
```python
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`
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 5 others
properties (23)
post_id83,942,391
authordappcoder
permlinksteem-python-beem-steem-api
categoryhive-180932
json_metadata{"tags":["cn","steem","whalepower","dblog","hive-143316","actnearn","neoxian","palnet","zzan","jjm","lifestyle","marlians","mediaofficials","sct-cn","sct-freeboard","upfundme","lassecash","spt","cc","steemleo","cn-stem","steemstem","cn-programming","sct","busy"],"image":["https:\/\/cdn.steemitimages.com\/DQmVFWvmtep5HzRpRZPusEAVf8BedyM574WX8YARR9WFsDC\/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202020-01-31%20%E4%B8%8B%E5%8D%885.16.37.png"],"links":["https:\/\/github.com\/steemit\/steem-python","https:\/\/steem.io"],"app":"busy\/2.5.4","format":"markdown"}
created2020-01-31 09:38:45
last_update2020-01-31 09:45:03
depth0
children2
net_rshares3,965,204,005,291
last_payout2020-02-07 09:38:45
cashout_time1969-12-31 23:59:59
total_payout_value0.415 SBD
curator_payout_value0.413 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,305
author_reputation71,889,699,236,580
root_title"如让官方的 steem-python 像 beem 一样 好用?动态寻找可用的 steem API 节点"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (69)
@steemitboard ·
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://steemitimages.com/60x70/http://steemitboard.com/@dappcoder/votes.png?202001311341"></td><td>You distributed more than 400 upvotes. Your next target is to reach 500 upvotes.</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@dappcoder) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=dappcoder)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
post_id83,950,925
authorsteemitboard
permlinksteemitboard-notify-dappcoder-20200131t152253000z
categoryhive-180932
json_metadata{"image":["https:\/\/steemitboard.com\/img\/notify.png"]}
created2020-01-31 15:22:51
last_update2020-01-31 15:22:51
depth1
children0
net_rshares0
last_payout2020-02-07 15:22:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length899
author_reputation38,705,954,145,809
root_title"如让官方的 steem-python 像 beem 一样 好用?动态寻找可用的 steem API 节点"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@chinesebi ·
$0.05
多搞一些机器人出来:)
👍  
properties (23)
post_id83,981,054
authorchinesebi
permlinkq515vw
categoryhive-180932
json_metadata{"app":"steemit\/0.2"}
created2020-02-01 16:02:21
last_update2020-02-01 16:02:21
depth1
children0
net_rshares302,071,154,697
last_payout2020-02-08 16:02:21
cashout_time1969-12-31 23:59:59
total_payout_value0.025 SBD
curator_payout_value0.025 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length11
author_reputation4,872,790,926,189
root_title"如让官方的 steem-python 像 beem 一样 好用?动态寻找可用的 steem API 节点"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)