Posted by stodge on June 22, 2010 at 2:44pm
I'm trying to write a Python XMLRPC client to talk to a Drupal site. So far I can anonymously connect and get a list of commands, but as soon as I try to login, I get:
xmlrpclib.Fault:
My code so far:
#!/usr/bin/python
import xmlrpclib
key='blahblah'
server = xmlrpclib.ServerProxy("http://localhost/community/services/xmlrpc")
connection = server.system.connect(key)
session = server.user.login(connection['sessid'], 'username', 'password')
print server.system.listMethods()
print server.node.get(89, [])Traceback:
Traceback (most recent call last):
File "./test.py", line 12, in <module>
session = server.user.login(key, connection['sessid'], 'username', 'password')
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in call
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: 'Missing required arguments.'>Am I missing something obvious? I've read a few examples and tried numerous alternatives for logging in, but nothing seems to work. Thanks
Comments
similar problem
I think you have a permissions problem, I had the same issue, I disabled key auth and just went with session based auth.
however this then progresses to
Traceback (most recent call last):
File "xmlrpc.py", line 16, in
session = server.user.login(connection['sessid'], uname, passwd)
File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in call
return self.__send(self.__name, args)
File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault:
not sure right now what other box i need to tick for anonymous users to auth.