Hi everybody,
I am trying to log to drupal using services. I use this code:
[python]
#! /usr/bin/python
import os.path, sys, time, mimetypes, xmlrpclib, pprint, base64
pp = pprint.PrettyPrinter()
config = {
'url': 'http://test.mokastudio.tv/services/xmlrpc',
'username': 'username',
'password': 'password',
}
# Make initial connection to service, then login as developer
server = xmlrpclib.Server(config['url'], allow_none=True);
connection = server.system.connect();
session = server.user.login(connection['sessid'], config['username'], config['password']);
[python]
However, it always returns xmlrpclib.Fault: ...
I tested to log directly at admin/build/services/browse/user.login and it works.
I also gave all permissions to anonymous users for testing...
What did I make wrong?
Best regards.
K.
Comments
Comment #1
Korchkidu commentedComment #2
mattconnolly commentedIn the current version of services module, you would use:
server = xmlrpclib.Server(config['url'], allow_none=True);
connection = server.system.connect();
session = server.user.login(config['username'], config['password']);
And then your session id is in session['sessid']
I still don't know how to use that sessid for subsequent requests so it looks like i'm logged in, however...