在wordpress上管理博客的命令行工具
twordpress的Python项目详细描述
一个命令行工具,用于管理wordpress.com上的博客。
配置文件
使用以下条目创建配置文件~/.config/twordpress/config:
[blog0] url=dilawarrajput.wordpress.com name=Dilawar's Blog user=dilawars password=pass [blog1] name=Dilawar's Notes url=dilawarnotes.wordpress.com user=dilawars password=abababaaati
如果选择将此文件存储到其他位置,则应传递 --config path/to/twordpressrc类似于twordpress命令的选项。
依赖关系
图书馆的岔口 https://github.com/maxcutler/python-wordpress-xmlrpc/blob/master/docs/index.rst 包含在此版本中。
您可以安装pandoc。此应用程序将html转换为markdown 格式,反之亦然。我可以做得更多,但这是我们需要的。如果pandoc是 不可用,则使用python脚本将html转换为文本。
代理支持最近添加到python-wordpress-xmlrcp。上面写着 环境变量http_proxy。如果你在代理网络后面,那么 export http_proxy=proxy.something.net:1212在你的bash中。我们很乐意 去吧。
三。获取帖子
以下命令获取post:
twordpress --blog 1 --fetch all twordpress --blog 0 --fetch "Python is awesome" twordpress
第一个命令将从blog1下载所有文章和页面。和第二遗嘱 从blog0下载与给定查询匹配的所有帖子。第三命令 将从默认博客(blog0)下载最近的条目。目前 不下载媒体。
每个post都有自己的目录和两个文件conetent.md和 content.html已创建。编辑标记文件并运行以下命令 更新帖子。
四。更新帖子
以下命令更新博客。
$twordpress --blog 0 --update path_to_new_content.md
5个。创建新帖子
这个指挥所一个新的哨所:
$twordpress --blog 1 --new new_blog.md
新博客是以降价的形式写的,但是元数据必须加上前缀。 这就是您的博客文件的外观。:
--- title: This is title of my awesome post status: publish tags: [some awesome tag, tag2] categories: [catA, some_category] --- Here is content of blog in markdown format. Too much has already been written. This ends my blog.