A client to download, edit and post blogs on wordpress

17 views
Skip to first unread message

Dilawar Singh

unread,
Dec 22, 2013, 3:57:21 PM12/22/13
to wncc...@googlegroups.com
Recently the proxy support was added to python-wordpress-xmlrpc library. Based
on this library, I was able to clean-up my old scripts to communicate with
wordpress via xmlrpc client. This client read the environment variable
http_proxy. No need to specify from command, although one can use --proxy in
command line. Set the http_proxy variable in bash file and `source ~/.bashrc`
before continue.

https://github.com/dilawar/pywordpress

This repository contains all dependencies (working version of
python-wordpress-xmlrcp library of Max Cutler). It uses pandoc to convert
markdown to html and vice versa. Since pandoc is very versatile tool, I removed
html2text script of late Aron Swartz. Unfortunately pandoc is not python based
and installing it would bring in whole Haskell stuff (who care inside IIT about
installing). It does not work with python3.

You need to create ~/.wordpressrc file with following entries

[blog0]
url=http://blog2.wordpress.com
username=user2
password=passowrd
[blog1]
url=http://blog1.wordpress.com
username=user1
password=password

Fetch
-----

1. To fetch all blogs from blog0

./wordpress.py --blog 0 --fetch all

2. To fetch blog with matching titles.
./wordpress.py --blog 0 --fetch "some pattern"

Change the --blog 0 to --blog 1 to work on blog1. It will create a directory for
each post and save the content in content.md (markdown) format inside that
directory.

Edit and post
------------
Edit the download `content.md`, and run the following command

./wordpress.py --blog 0 --update path_to_content.md

(Make sure to give the right blog no).

For a new post. Create a new post with header similar to one of the content.md
file. An example is following.

~~~~
title: Managing music using mpd/mpc
type: post
status: publish
tag: Advanced Linux Sound Architecture
tag: Music Player Daemon
category: NoGuiNoMouseNoProblem
~~~~

## Heading
Content of _your post_ goes here in markdown format.


After saving the file to (e.g. post.md), run the following command,

./wordpress.py --blog 1 --new post.md

Metadata
--------

Metadata of post is stored at the beginning of the post between `~~~~~`
tags. This is jekyll format of writing post. If one is managing
github-pages, the same post can be posted to wordpress.

One can edit the metadata to change the status of post from 'publish' to
draft etc. More tags can be added or deleted. Same with categories.

Following features are most likely to be added soon.

1. Downloading media for each post.
2. Ability to embed offline media in markdown file.

Notes
-----

A pure html is send to wordpress. Html is created by pandoc from markdown.
Fork the repo and send the pull request to add more features.

Hope some people will find it useful.

--
Dilawar
NCBS Bangalore
EE, IIT Bombay

Dilawar

unread,
Dec 23, 2013, 12:38:28 PM12/23/13
to wncc...@googlegroups.com
Some changes are made to the client. If pandoc is not available, it can use python-markdown libary.

Package is now available on pypi

     https://pypi.python.org/pypi/twordpress/0.1.1

To install,
  
     sudo -E pip install --proxy $http_proxy  twordpress

- Dilawar

Reply all
Reply to author
Forward
0 new messages