Vamsi Krishna
Vamsi Krishna

Reputation: 93

Display posts from Wordpress blog in webpage hosted on google app engine

I am trying to display titles of the posts (along with date and link to the post) from my wordpress blog on my webpage which is hosted on google app engine. Can I import python's xmlrpc module and use getRecentPosts function to get the list of the posts? How can I get the date and link of the post and display it on my webpage?

Thanks in advance.

Upvotes: 1

Views: 258

Answers (2)

Nick Johnson
Nick Johnson

Reputation: 101149

One easy option would be to use Beautiful Soup to read your blog's RSS feed, and syndicate that on your front page.

Upvotes: 1

Merlyn Morgan-Graham
Merlyn Morgan-Graham

Reputation: 59111

From: http://ttm.appspot.com/blog/2008/12/20/wordpress-xml-rpc-getrecentposts-behaviour/

Here's some code that will call getRecentPosts and output it in the response:

username = 'yourUser'
password = 'yourPassword'
xmlrpc_url = "http://www.yourblog.net/wordpress/xmlrpc.php"
sp = xmlrpclib.ServerProxy(xmlrpc_url)
# recent posts list:
rpl = sp.metaWeblog.getRecentPosts(1, username, password, 700)
self.response.out.write(rpl)

But this won't work...

The problem I'm having with testing this, though, is that Python 2.7 has a bug where I get this error:

TypeError: endheaders() takes exactly 1 argument (2 given)

That's solved in a patch that was posted here:

https://github.com/facebook/python-sdk/pull/62

Not sure how easy it would be to apply that patch. It was made fairly recently (August), so I don't know if it would be in the main Python branch yet.

You probably won't be able to use the library without that fix, though.

Upvotes: 1

Related Questions