import sys import urllib import md5 import json def run(client, session, server, args): if len(args) == 0: print "invitekey required" return invitekey = args[0] user = args[1] password = args[2] firstname = args[3] lastname = args[4] data = {"username": user, "password": password} if firstname is not None: data['firstname'] = firstname if lastname is not None: data['lastname'] = lastname headers = {"Content-type": "application/json", "Accept": "text/plain", "Cookie": "RS_API=" + str(session)} client.request("POST", "/api/user/confirm/" + invitekey, json.dumps(data), headers) response = client.getresponse() print "HTTP Status/Reason: " + str(response.status) + " / " + response.reason print "Response header: " + str(response.getheaders()) print "Response:" print response.read()