maxcutler / python-wordpress-xmlrpc

Python library for WordPress XML-RPC integration
http://python-wordpress-xmlrpc.rtfd.org
MIT License
382 stars 130 forks source link

Multi site #118

Open jinyu121 opened 6 years ago

jinyu121 commented 6 years ago

My wordpress uses multi-site, and have 3 sites using sub-folder style, lets call them /, /site_a and /site_b

if I want to connect to the first site, that's OK. but if I want to connect the second and third site, error occurred.

wp = Client('http://mysite.wordpress.com/site_a/xmlrpc.php', 'username', 'password', blog_id=2)

(You say that the blog_id parameter will be ignored... That's true... So i write xxxx/site_a here )

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/haoyu/Workspace/wordpress/venv/local/lib/python2.7/site-packages/wordpress_xmlrpc/base.py", line 24, in __init__
    self.supported_methods = self.server.mt.supportedMethods()
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1316, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1487, in parse_response
    p.feed(data)
  File "/usr/lib/python2.7/xmlrpclib.py", line 558, in feed
    self._parser.Parse(data, 0)
ExpatError: XML or text declaration not at start of entity: line 1, column 2

and I also tried python3, same error happens.

PHP7 is used on server


UPDATE: dup #101 , But can you fix it?

ntropia2 commented 4 years ago

I know it's been a while since you asked, but maybe you're still interested.

Have you tried connecting to the actual URL of the (sub)sites, instead of accessing them through the main one (network)? In your case it would be something like: http://site_a.com/xmlrpc.php instead of http://mysite.wordpress.com/site_a/xmlrpc.php For me it worked fine.