Question

I'm using pyblog module (python blogger) [See P.S. at the bottom for wordpress_xmlrpc] to automate operations on a wordpress blog, as suggested here. Pyblog home page describes a simple using script:

import pyblog
blog = pyblog.WordPress('http://www.example.com/blog/xmlrpc.api', 'USERNAME', 'PASSWORD')
print blog.get_recent_posts()

When I run it locally, the script works fine. But when I deploy it on google app engine, I encounter the following error about the blog.get_recent_posts line:

return self.execute('metaWeblog.getRecentPosts', blogid, self.username, self.password, numposts)
File "/base/data/home/apps/myappname/1.371326087278559778/pyblog.py", line 93, in execute
raise BlogError(fault.faultString)
BlogError: parse error. not well formed

which refers to the following lines in pyblog.py:

try:
    r = getattr(self.server, methodname)(args)
except xmlrpclib.Fault, fault:
    raise BlogError(fault.faultString)

Removing the try/except the error occurred is indicated as:

Fault -32700: 'parse error. not well formed'

How to solve?

P.S.: I've tried a similar script using python-wordpress-xmlrpc library. Running the example script suggested here

from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo

wp = Client('http://mysite.wordpress.com/xmlrpc.php', 'username', 'password')
wp.call(GetUserInfo())
<WordPressUser: max>

raises the same error!

Was it helpful?

Solution

I suspect the problem is that GAE blocks any outbound requests that do not use their URLFetch service at the foundation; you can't use ordinary sockets, for example. Google's versions of urllib etc. have been modified so that they use URLFetch internally.

Here's an old but very thorough article that discusses a similar XMLRPC situation and provides some solutions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top