要求: 1. 能在各种恶劣网络环境下,正常工作; 2. 每30分钟定时领取一次 ![0.jpg](https://cdn.steemitimages.com/DQmSLANaocCRwtucagvYzYrcu65Y6xLzzShZZavuE6adfw8/0.jpg) 由于[Steem](https://steem.io) 官方的 API 节点 https://api.steemit.com 因种种原因而无法访问,其他第三方的API 节点,也出各种状况.所以稳健的机器人,要在这些API 节点动态寻找可用API 节点. 示范程序(auto_claim_bot.py): ----------------------------- ```python import steembase import steem from pick import pick from steem.steemd import Steemd from steem.account import Account from steem.amount import Amount from steem.instance import set_shared_steemd_instance 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', ] set_shared_steemd_instance(Steemd(nodes=steemd_nodes)) # username = input('Enter username: ') username = 'dappcoder' # post_key = input('Enter private POST key: ') post_key = '5JzkkkkkK3ZN' # connect node client = steem.Steem(nodes=steemd_nodes, keys=[post_key]) # get account reward balances userinfo = client.get_account(username) print('userinfo:', userinfo) if(userinfo is None): print('Oops. Looks like user ' + username + ' doesn\'t exist on this chain!') exit() reward_steem = userinfo['reward_steem_balance'] reward_sbd = userinfo['reward_sbd_balance'] reward_sp = userinfo['reward_vesting_steem'] reward_vests = userinfo['reward_vesting_balance'] print('Reward Balances:' + '\n' + 'STEEM: ' + reward_steem + '\n' + 'SBD: ' + reward_sbd + '\n' + 'STEEM POWER: ' + reward_sp + '\n' + 'VESTS: ' + reward_vests ) if Amount(reward_steem).amount + Amount(reward_sbd).amount + Amount(reward_vests).amount == 0: print('\n' + 'No rewards to claim') exit() else: client.claim_reward_balance( reward_steem, reward_sbd, reward_vests, username) print( '\n' + 'All reward balances have been claimed. New reward balances are:' + '\n') userinfo = client.get_account(username) reward_steem = userinfo['reward_steem_balance'] reward_sbd = userinfo['reward_sbd_balance'] reward_sp = userinfo['reward_vesting_steem'] reward_vests = userinfo['reward_vesting_balance'] print('STEEM: ' + reward_steem + '\n' + 'SBD: ' + reward_sbd + '\n' + 'STEEM POWER: ' + reward_sp + '\n' + 'VESTS: ' + reward_vests ) ``` 执行程序:`python auto_claim_bot.py` 执行结果符合预期: ![屏幕快照 2020-02-02 下午12.51.53.png](https://cdn.steemitimages.com/DQmWV8xK6kXFEW6YXDMDeGiuETrZFYs2A31hmovWKj7wr1A/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202020-02-02%20%E4%B8%8B%E5%8D%8812.51.53.png) MacOS 上自动定时执行:`$ crontab -e` ```crontab */30 * * * * /usr/bin/python /path/auto_claim_bot.py >> /tmp/auto_claim_bot.log ```
post_id | 83,995,219 |
---|---|
author | dappcoder |
permlink | steem-python-steem |
category | hive-180932 |
json_metadata | {"tags":["cn","chinese","whalepower","dblog","actnearn","neoxian","palnet","marlians","cn-marlians","mediaofficials","sct","sct-cn","sct-freeboard","upfundme","lassecash","spt","cc","steemleo","liv","vi","cn-stem","steemstem","cn-programming","hive-143316","zzan"],"image":["https:\/\/cdn.steemitimages.com\/DQmSLANaocCRwtucagvYzYrcu65Y6xLzzShZZavuE6adfw8\/0.jpg","https:\/\/cdn.steemitimages.com\/DQmWV8xK6kXFEW6YXDMDeGiuETrZFYs2A31hmovWKj7wr1A\/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202020-02-02%20%E4%B8%8B%E5%8D%8812.51.53.png"],"links":["https:\/\/steem.io","https:\/\/api.steemit.com"],"app":"steemzzang\/0.1","format":"markdown"} |
created | 2020-02-02 04:55:36 |
last_update | 2020-02-02 04:55:36 |
depth | 0 |
children | 7 |
net_rshares | 5,272,907,119,423 |
last_payout | 2020-02-09 04:55:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.613 SBD |
curator_payout_value | 0.606 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 2,801 |
author_reputation | 71,889,699,236,580 |
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
msg768 | 0 | 1,957,427,831 | 5% | ||
steemitlotteries | 0 | 143,652,833 | 65% | ||
insiders | 0 | 239,043,395 | 78% | ||
techken | 0 | 45,310,406 | 0.6% | ||
haiyangdeperci | 0 | 7,466,780,932 | 20% | ||
pixresteemer | 0 | 847,884,831 | 1.95% | ||
dobartim | 0 | 432,263,869,908 | 6% | ||
andrewma | 0 | 46,637,002 | 0.5% | ||
anonyvoter | 0 | 467,746,533 | 2% | ||
slientstorm | 0 | 116,056,563,469 | 100% | ||
laissez-faire | 0 | 156,492,349 | 100% | ||
swiftcash | 0 | 22,377,156,762 | 5% | ||
cn-zzang | 0 | 1,692,387,425 | 5% | ||
cn-leo | 0 | 113,244,841 | 2% | ||
cn-pal | 0 | 588,136,317 | 5% | ||
cn-marlians | 0 | 1,472,989,168 | 5% | ||
cn-neoxag | 0 | 101,821,682 | 5% | ||
dappcoder | 0 | 679,606,117 | 100% | ||
trust187 | 0 | 356,040,180 | 1.95% | ||
tex.fund | 0 | 585,828,825 | 100% | ||
hnt | 0 | 670,549,268 | 100% | ||
acu.fund | 0 | 938,252,822 | 100% | ||
dblogbasicincome | 0 | 87,018,923 | 7% | ||
mana.bank | 0 | 5,119,611,947 | 100% | ||
acu.fund.witness | 0 | 683,948,904 | 100% | ||
spbank | 0 | 572,893,046 | 100% | ||
yaowl | 0 | 573,202,895 | 100% | ||
alanyao | 0 | 581,835,995 | 100% | ||
missingwolf | 0 | 605,666,600 | 100% | ||
xinhuaren | 0 | 571,925,213 | 100% | ||
acufund | 0 | 566,154,507 | 100% | ||
downvoter | 0 | 997,148,065 | 100% | ||
manabot1 | 0 | 556,341,188 | 100% | ||
manabot | 0 | 564,843,684 | 100% | ||
huaren.news | 0 | 4,113,839,430,217 | 100% | ||
cameron.barnes | 0 | 547,189,006 | 100% | ||
manabot2 | 0 | 555,234,422 | 100% | ||
sherryzhou | 0 | 572,650,982 | 98% | ||
goodvoter | 0 | 551,919,481 | 100% | ||
anonymity.inlet | 0 | 624,166,618 | 100% | ||
manabot3 | 0 | 558,949,731 | 100% | ||
manabot4 | 0 | 0 | 100% | ||
manabank | 0 | 538,211,216 | 100% | ||
texfund | 0 | 550,965,716 | 100% | ||
goodreader | 0 | 544,139,749 | 100% | ||
goodposter | 0 | 551,451,403 | 100% | ||
goodcurator | 0 | 2,508,353,020 | 100% | ||
goodauthor | 0 | 547,627,326 | 100% | ||
shanyi | 0 | 542,181,486 | 100% | ||
yuwenzhaobin | 0 | 552,359,514 | 100% | ||
huangyiru | 0 | 554,560,783 | 100% | ||
qiuruling | 0 | 544,201,618 | 100% | ||
tongpingxia | 0 | 540,035,162 | 100% | ||
fushuo | 0 | 547,910,752 | 100% | ||
downscaner | 0 | 615,690,883 | 100% | ||
wang.han | 0 | 541,788,948 | 97% | ||
anonym.inlet | 0 | 542,018,643 | 100% | ||
rongyongyu | 0 | 539,961,312 | 100% | ||
heyaochen | 0 | 546,863,211 | 100% | ||
miyijuan | 0 | 546,250,397 | 100% | ||
xiangsong | 0 | 541,926,513 | 100% | ||
haiyaochang | 0 | 541,140,236 | 100% | ||
zhangyanxie | 0 | 556,506,701 | 100% | ||
jiduanren | 0 | 539,961,096 | 100% | ||
hanyiya | 0 | 539,960,889 | 100% | ||
guxiefeng | 0 | 539,961,138 | 100% | ||
hejuangang | 0 | 539,960,405 | 100% | ||
mengyin | 0 | 539,960,107 | 100% | ||
liaohepeng | 0 | 543,812,052 | 100% | ||
gaituan | 0 | 539,959,502 | 100% | ||
quxibei | 0 | 539,959,325 | 100% | ||
dblogvoter | 0 | 75,067,672 | 1.95% | ||
huarennews | 0 | 602,460,755 | 100% | ||
qukehan | 0 | 0 | 100% | ||
lvziyun | 0 | 455,267,232,123 | 100% | ||
steem-holder | 0 | 0 | 2% | ||
chinesebi | 0 | 79,762,468,534 | 100% | ||
staryao | 0 | 932,129,341 | 100% | ||
steem.buzz | 0 | 452,527,575 | 100% |
我所有的梯子都挂了.远程能个机器人,倒是可以省事了 !shop
post_id | 84,038,607 |
---|---|
author | lvziyun |
permlink | q54sgo |
category | hive-180932 |
json_metadata | {"app":"busy\/2.5.4"} |
created | 2020-02-03 15:02:51 |
last_update | 2020-02-03 15:15:06 |
depth | 1 |
children | 0 |
net_rshares | -22,856,871,001 |
last_payout | 2020-02-10 15:02:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 31 |
author_reputation | 42,876,785,860,535 |
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
steemflagrewards | 0 | -4,056,174,265,449 | -78% | ||
blarchive | 0 | -135,602,882,102 | -39% | ||
huaren.news | 0 | 3,761,058,695,370 | 100% | ||
lvziyun | 0 | 407,861,581,180 | 100% |
你好鸭,dappcoder! @lvziyun给您叫了一份外卖! 由 @jjprac jjprac 在晴空万里 开着巴士 给您送来 **蔬菜培根卷** <br> ![](https://cdn.steemitimages.com/DQmaaPPNjLFnmdJEsMLZXwodwjxwfD2bKcZmjjRaCB4gKZx/image.png) 吃饱了吗?跟我猜拳吧! **石头,剪刀,布~** 如果您对我的服务满意,请不要吝啬您的点赞~ @onepagex
post_id | 84,038,623 |
---|---|
author | teamcn-shop |
permlink | q54sgo |
category | hive-180932 |
json_metadata | "{"app":"teamcn-shop bot\/1.0"}" |
created | 2020-02-03 15:03:03 |
last_update | 2020-02-03 15:15:18 |
depth | 1 |
children | 2 |
net_rshares | 0 |
last_payout | 2020-02-10 15:03:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 234 |
author_reputation | 65,900,527,192,856 |
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
剪刀
post_id | 84,039,097 |
---|---|
author | lvziyun |
permlink | q54szr |
category | hive-180932 |
json_metadata | {"app":"busy\/2.5.4"} |
created | 2020-02-03 15:14:18 |
last_update | 2020-02-03 15:14:18 |
depth | 2 |
children | 1 |
net_rshares | 257,237,832,647 |
last_payout | 2020-02-10 15:14:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.021 SBD |
curator_payout_value | 0.022 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 2 |
author_reputation | 42,876,785,860,535 |
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
lvziyun | 0 | 257,237,832,647 | 100% |
https://4.bp.blogspot.com/-D1FktV9gZP4/WoGwFdRlKoI/AAAAAAATXJA/UPoM2KOdBokqK-9u-4SUH-MuswtcHG_HQCLcBGAs/s1600/AW785125_16.gif You win!!!! 你赢了!我这新手村猜拳小能手的名号让给你了! 给你1枚SHOP币!
post_id | 84,039,104 |
---|---|
author | teamcn-shop |
permlink | q54szr |
category | hive-180932 |
json_metadata | "{"app":"teamcn-shop bot\/1.0"}" |
created | 2020-02-03 15:14:27 |
last_update | 2020-02-03 15:14:27 |
depth | 3 |
children | 0 |
net_rshares | 0 |
last_payout | 2020-02-10 15:14:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 173 |
author_reputation | 65,900,527,192,856 |
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
🐂,我也要搞机器人
post_id | 84,040,897 | ||||||
---|---|---|---|---|---|---|---|
author | lvziyun | ||||||
permlink | re-dappcoder-202024t02332109z | ||||||
category | hive-180932 | ||||||
json_metadata | {"tags":["cn","chinese","whalepower","dblog","actnearn","neoxian","palnet","marlians","cn-marlians","mediaofficials","sct","sct-cn","sct-freeboard","upfundme","lassecash","spt","cc","steemleo","liv","vi","cn-stem","steemstem","cn-programming","hive-143316","zzan"],"app":"esteem\/2.2.4-mobile","format":"markdown+html","community":"hive-125125"} | ||||||
created | 2020-02-03 16:23:36 | ||||||
last_update | 2020-02-03 16:23:36 | ||||||
depth | 1 | ||||||
children | 0 | ||||||
net_rshares | -17,356,370,817 | ||||||
last_payout | 2020-02-10 16:23:36 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 0.000 SBD | ||||||
curator_payout_value | 0.000 SBD | ||||||
pending_payout_value | 0.000 SBD | ||||||
promoted | 0.000 SBD | ||||||
body_length | 9 | ||||||
author_reputation | 42,876,785,860,535 | ||||||
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 SBD | ||||||
percent_steem_dollars | 10,000 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
enforcer48 | 0 | -234,020,289,001 | -60% | ||
lvziyun | 0 | 216,663,918,184 | 100% |
很详细啊,应该能学会
post_id | 84,040,909 | ||||||
---|---|---|---|---|---|---|---|
author | lvziyun | ||||||
permlink | re-dappcoder-202024t02427749z | ||||||
category | hive-180932 | ||||||
json_metadata | {"tags":["cn","chinese","whalepower","dblog","actnearn","neoxian","palnet","marlians","cn-marlians","mediaofficials","sct","sct-cn","sct-freeboard","upfundme","lassecash","spt","cc","steemleo","liv","vi","cn-stem","steemstem","cn-programming","hive-143316","zzan"],"app":"esteem\/2.2.4-mobile","format":"markdown+html","community":"hive-125125"} | ||||||
created | 2020-02-03 16:24:27 | ||||||
last_update | 2020-02-03 16:24:27 | ||||||
depth | 1 | ||||||
children | 0 | ||||||
net_rshares | -104,878,659,145 | ||||||
last_payout | 2020-02-10 16:24:27 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 0.000 SBD | ||||||
curator_payout_value | 0.000 SBD | ||||||
pending_payout_value | 0.000 SBD | ||||||
promoted | 0.000 SBD | ||||||
body_length | 10 | ||||||
author_reputation | 42,876,785,860,535 | ||||||
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 SBD | ||||||
percent_steem_dollars | 10,000 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
steemflagrewards | 0 | -5,200,237,519,806 | -100% | ||
blarchive | 0 | -168,442,051,517 | -50% | ||
huaren.news | 0 | 5,051,455,145,314 | 100% | ||
lvziyun | 0 | 212,345,766,864 | 100% |
有机器人真好,
post_id | 84,040,973 | ||||||
---|---|---|---|---|---|---|---|
author | lvziyun | ||||||
permlink | re-dappcoder-202024t02825798z | ||||||
category | hive-180932 | ||||||
json_metadata | {"tags":["cn","chinese","whalepower","dblog","actnearn","neoxian","palnet","marlians","cn-marlians","mediaofficials","sct","sct-cn","sct-freeboard","upfundme","lassecash","spt","cc","steemleo","liv","vi","cn-stem","steemstem","cn-programming","hive-143316","zzan"],"app":"esteem\/2.2.4-mobile","format":"markdown+html","community":"hive-125125"} | ||||||
created | 2020-02-03 16:28:27 | ||||||
last_update | 2020-02-03 16:28:27 | ||||||
depth | 1 | ||||||
children | 0 | ||||||
net_rshares | -89,160,149,138 | ||||||
last_payout | 2020-02-10 16:28:27 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 0.000 SBD | ||||||
curator_payout_value | 0.000 SBD | ||||||
pending_payout_value | 0.000 SBD | ||||||
promoted | 0.000 SBD | ||||||
body_length | 7 | ||||||
author_reputation | 42,876,785,860,535 | ||||||
root_title | "用官方的 steem-python 做一个稳健领取 steem 作者奖励和审查奖励的定时机器人" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 SBD | ||||||
percent_steem_dollars | 10,000 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
steemflagrewards | 0 | -3,432,139,763,072 | -66% | ||
enforcer48 | 0 | -179,398,596,952 | -46% | ||
blarchive | 0 | -117,841,843,048 | -33% | ||
huaren.news | 0 | 3,640,220,053,934 | 100% |