create account

使用steempy / steem-python 转发7天以前的帖子 by oflyhigh

View this thread on: hive.blogpeakd.comecency.com
· @oflyhigh ·
$102.54
使用steempy / steem-python 转发7天以前的帖子
在文章[《O哥闲扯淡: 转发才是真爱粉吗?》](https://steemit.com/cn/@oflyhigh/o)中,我提到我以前对转发进行了一些研究,比如说做了一个丑陋无比的[检查谁转发了你的文章的网页工具](https://steemit.com/cn/@oflyhigh/who-resteemed-rebloged-your-posts)以及测试了[如何使用SteemConnect转发7天以上的文章](https://steemit.com/reblog/@oflyhigh/how-to-reblog-resteem-articles-which-posted-7-days-ago-with-steemconnect-steemconnect-7)。

![](https://steemitimages.com/DQmXQzDMbiUMFVUWX8A9qodarzSPfjvgJH9NufV46enHncb/image.png)
(图源:[bing.com](bing.com))

当时写这篇O哥闲扯淡的时候,我突然就想,我怎么没测试一下使用steem-python来测试转发功能呢?回头一定要补上,今天终于抽出时间来把这个补上喽。

# 安装和导入私钥

#### 安装

现在有两个版本的steem-python,分别是
* https://github.com/Netherdrake/steem-python
* https://github.com/steemit/steem-python

我个人推荐使用 Netherdrake (@furion)的版本,或者官网的早期版本,官网的新版本加了很多功能,但是同样也使得这个库变得复杂和臃肿。

选择你要使用的版本,安装见对应github链接的安装说明即可。

#### 导入私钥

在STEEMIT上,进入**`Wallet->Permissions->Show private key`**获取你的POSTING 私钥。

在命令行使用
**`steempy addkey`**
按提示导入私钥即可,如果是首次创建钱包,会提示你为钱包设置密码。

# 使用steempy转发文章

安装完steem-python库以后,就可以使用steempy命令行工具了。

比如使用:`steempy --help` 查看帮助
或者使用:`steempy resteem --help`查询关于转发的详细帮助

![](https://steemitimages.com/DQmRTSwwRdWBhGNcvPJd1uetax6EaVNGxjayMyCJwz7C9rY/image.png)

有了这些准备后,我们就可以用它来转发文章了,比如转发[《O哥闲扯淡: 转发才是真爱粉吗?》](https://steemit.com/cn/@oflyhigh/o)到oflyhigh.test账户下:

指令: `steempy resteem --account oflyhigh.test @oflyhigh/o`

按提示输入钱包密码后提示如下,说明操作成功了。
![](https://steemitimages.com/DQmUMhfHXecXXHwVMhvkfdYoX4xV4y1UXP1F4W1Xwph5YwX/image.png)

我们可以用同样的方式转发8个月以前的文章
`steempy resteem --account oflyhigh.test @oflyhigh/19-informal-translation-hf19-equality-coming-soon-linear-rewards`

进入 @oflyhigh.test 的主页,可以看到两篇转发的文章

![](https://steemitimages.com/DQmSRj42po8km1vvQy3fHayDRxSNgWk4aFeizFaEk14ggtY/image.png)


# 使用 python 脚本转发

除了使用命令行,使用python脚本来操作也一样简单。
比如我要转发这篇[《那年夏天》](https://steemit.com/cn/@oflyhigh/341nku),那么最简单的脚本示例如下:
```
from steem import Steem

identifier = '@oflyhigh/341nku'
account = 'oflyhigh.test'

steem = Steem()
steem.commit.resteem(identifier, account)
```

脚本执行成功后,再访问我们的 @oflyhigh.test 的主页
![](https://steemitimages.com/DQmV1UAfnfsmyzGuJK7JWNCRBVDue7ziTytToK4vt4Srbds/image.png)

耶,成功了!

# 结论

无论使用steempy还是python脚本转发文章都非常简单,重要的是,我们可以转发7天以前(任意时间)的文章,而不像在steemit上,我们要受到只能7天以内文章的限制。

尽管如下,我依然建议大家读读[《O哥闲扯淡: 转发才是真爱粉吗?》](https://steemit.com/cn/@oflyhigh/o),慎重的转发有价值的内容,而不要见啥转啥。


# 关联阅读
* [O哥闲扯淡: 转发才是真爱粉吗?](https://steemit.com/cn/@oflyhigh/o)
* [Who resteemed/rebloged your posts? / 谁转发了你的文章?](https://steemit.com/cn/@oflyhigh/who-resteemed-rebloged-your-posts)
* [📌 How to reblog/resteem articles which posted 7 days ago with SteemConnect? / 使用SteemConnect转发7天以上的文章](https://steemit.com/reblog/@oflyhigh/how-to-reblog-resteem-articles-which-posted-7-days-ago-with-steemconnect-steemconnect-7)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 108 others
properties (23)
authoroflyhigh
permlinksteempy-steem-python-7
categorypython
json_metadata{"tags":["python","steemdev","steempy","cn-programming","cn"],"users":["furion","oflyhigh.test"],"image":["https://steemitimages.com/DQmXQzDMbiUMFVUWX8A9qodarzSPfjvgJH9NufV46enHncb/image.png","https://steemitimages.com/DQmRTSwwRdWBhGNcvPJd1uetax6EaVNGxjayMyCJwz7C9rY/image.png","https://steemitimages.com/DQmUMhfHXecXXHwVMhvkfdYoX4xV4y1UXP1F4W1Xwph5YwX/image.png","https://steemitimages.com/DQmSRj42po8km1vvQy3fHayDRxSNgWk4aFeizFaEk14ggtY/image.png","https://steemitimages.com/DQmV1UAfnfsmyzGuJK7JWNCRBVDue7ziTytToK4vt4Srbds/image.png"],"links":["https://steemit.com/cn/@oflyhigh/o","https://steemit.com/cn/@oflyhigh/who-resteemed-rebloged-your-posts","https://steemit.com/reblog/@oflyhigh/how-to-reblog-resteem-articles-which-posted-7-days-ago-with-steemconnect-steemconnect-7","bing.com","https://github.com/Netherdrake/steem-python","https://github.com/steemit/steem-python","https://steemit.com/cn/@oflyhigh/341nku"],"app":"steemit/0.1","format":"markdown"}
created2018-02-16 13:38:45
last_update2018-02-16 13:38:45
depth0
children13
last_payout2018-02-23 13:38:45
cashout_time1969-12-31 23:59:59
total_payout_value90.100 HBD
curator_payout_value12.438 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,676
author_reputation6,315,803,163,783,586
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,007,080
net_rshares17,014,443,880,681
author_curate_reward""
vote details (172)
@antonsteemit ·
steem-python超好用,python好寫又好懂,之前寫的bot全都是靠它完成的~
👍  ,
properties (23)
authorantonsteemit
permlinkre-oflyhigh-steempy-steem-python-7-20180216t163010793z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-16 16:30:12
last_update2018-02-16 16:30:12
depth1
children0
last_payout2018-02-23 16:30:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length44
author_reputation7,534,465,964,895
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,042,362
net_rshares861,873,846
author_curate_reward""
vote details (2)
@bestbird ·
好多不会用  新人很无奈 啊  慢慢摸索...
properties (22)
authorbestbird
permlinkre-oflyhigh-steempy-steem-python-7-20180217t004652317z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-17 00:46:54
last_update2018-02-17 00:46:54
depth1
children0
last_payout2018-02-24 00:46:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length23
author_reputation0
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,127,813
net_rshares0
@hhjjkk ·
蛮有实用性的,可以学习学习
properties (22)
authorhhjjkk
permlinkre-oflyhigh-steempy-steem-python-7-20180217t032100274z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-17 03:21:03
last_update2018-02-17 03:21:03
depth1
children0
last_payout2018-02-24 03:21:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation684,424,592,252
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,153,200
net_rshares0
@intelli-jan-tam ·
&#127817  Cool! This is helpful. Thanks &  phenomenal!
properties (22)
authorintelli-jan-tam
permlinkre-oflyhigh-steempy-steem-python-7-1518790138052t04ef9977-a42d-49ca-8f04-def087cde37fuid
categorypython
json_metadata{"tags":["ilikeit"],"app":"SteemJ-Core/0.4.3","format":"markdown"}
created2018-02-16 14:08:57
last_update2018-02-16 14:08:57
depth1
children0
last_payout2018-02-23 14:08:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length54
author_reputation1,404,923,971,285
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,013,223
net_rshares0
@itsok ·
为什么转帖也要程序来做了啊?
properties (22)
authoritsok
permlinkre-oflyhigh-steempy-steem-python-7-20180216t141228409z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-16 14:12:30
last_update2018-02-16 14:12:30
depth1
children0
last_payout2018-02-23 14:12:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length14
author_reputation131,842,546,165
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,014,019
net_rshares0
@joythewanderer ·
$0.26
学习了,竟然也8个月以前的也可以转发。果然Python是神语言。
👍  
properties (23)
authorjoythewanderer
permlinkre-oflyhigh-steempy-steem-python-7-20180216t135716966z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-16 13:57:15
last_update2018-02-16 13:57:15
depth1
children2
last_payout2018-02-23 13:57:15
cashout_time1969-12-31 23:59:59
total_payout_value0.201 HBD
curator_payout_value0.063 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length32
author_reputation1,916,082,145,948,706
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,010,780
net_rshares44,891,861,020
author_curate_reward""
vote details (1)
@oflyhigh ·
$0.14
steem-python 神奇
👍  
properties (23)
authoroflyhigh
permlinkre-joythewanderer-re-oflyhigh-steempy-steem-python-7-20180216t143310486z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-16 14:33:12
last_update2018-02-16 14:33:12
depth2
children1
last_payout2018-02-23 14:33:12
cashout_time1969-12-31 23:59:59
total_payout_value0.106 HBD
curator_payout_value0.031 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length15
author_reputation6,315,803,163,783,586
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,018,372
net_rshares23,227,983,827
author_curate_reward""
vote details (1)
@apkdl ·
love you steemit blog thanks...follow you blog and vote
properties (22)
authorapkdl
permlinkre-oflyhigh-re-joythewanderer-re-oflyhigh-steempy-steem-python-7-20180216t150414564z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-16 15:04:15
last_update2018-02-16 15:04:15
depth3
children0
last_payout2018-02-23 15:04:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation981,338,956,761
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,024,763
net_rshares0
@minhazahmed ·
hey there
properties (22)
authorminhazahmed
permlinkre-oflyhigh-steempy-steem-python-7-20180216t142147527z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-16 14:21:51
last_update2018-02-16 14:21:51
depth1
children0
last_payout2018-02-23 14:21:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length9
author_reputation28,312,658,593
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,016,032
net_rshares0
@moniristi ·
wow best technological post. i like coding very much . Python and java is my favorite language to codding
properties (22)
authormoniristi
permlinkre-oflyhigh-steempy-steem-python-7-20180216t134407756z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-16 13:42:03
last_update2018-02-16 13:42:03
depth1
children0
last_payout2018-02-23 13:42:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length105
author_reputation5,625,366,645,317
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,007,709
net_rshares0
@pwangdu ·
&#128164 ![l](http://mrwgifs.com/wp-content/uploads/2013/03/MRW-Dwayne-The-Rock-Johnson-Likes-It-Gif.gif) &  ashtonishing!
properties (22)
authorpwangdu
permlinkre-oflyhigh-steempy-steem-python-7-1518790161532t1879d4f7-e6c7-454c-bb3e-39b99c7632a8uid
categorypython
json_metadata{"tags":["ilikeit"],"links":["http://mrwgifs.com/wp-content/uploads/2013/03/MRW-Dwayne-The-Rock-Johnson-Likes-It-Gif.gif"],"app":"SteemJ-Core/0.4.3","format":"markdown"}
created2018-02-16 14:09:21
last_update2018-02-16 14:09:21
depth1
children0
last_payout2018-02-23 14:09:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length122
author_reputation4,557,349,567,330
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,013,306
net_rshares0
@tvb ·
我在想能不能转发自己的贴子,不会phython干着急。。。
properties (22)
authortvb
permlinkre-oflyhigh-steempy-steem-python-7-20180220t042332116z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-02-20 04:23:30
last_update2018-02-20 04:23:30
depth1
children0
last_payout2018-02-27 04:23:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length29
author_reputation35,178,037,825,802
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,964,809
net_rshares0
@wahyuddin ·
please in folow
properties (22)
authorwahyuddin
permlinkre-oflyhigh-2018216t212757893z
categorypython
json_metadata{"tags":["python","steemdev","steempy","cn-programming","cn"],"app":"esteem/1.5.1","format":"markdown+html","community":"esteem"}
created2018-02-16 14:28:03
last_update2018-02-16 14:28:03
depth1
children0
last_payout2018-02-23 14:28:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length15
author_reputation3,220,361,651
root_title"使用steempy / steem-python 转发7天以前的帖子"
beneficiaries
0.
accountesteemapp
weight1,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,017,301
net_rshares0