def do_add_client(self, id, app_id): if id in self.registry.getClients(): print("Client id already taken") exit(1) try: app = self.registry.getApp(app_id) client = ZotonicClient(app) token = client.register_client() self.registry.addClient(id, app_id, token.key, token.secret) self.registry.save() print("OK") except ConfigParser.NoSectionError: print("No such app: "+app_id) exit(1)
def do_add_client(self, id, app_id): if id in self.registry.getClients(): print("Client id already taken") exit(1) try: app = self.registry.getApp(app_id) client = ZotonicClient(app) token = client.register_client() self.registry.addClient(id, app_id, token.key, token.secret) self.registry.save() print("OK") except ConfigParser.NoSectionError: print("No such app: " + app_id) exit(1)
def do_request(self, client_id, method, *args): client = self.registry.getClient(client_id) client = ZotonicClient(client) params = dict((a.split("=",1) for a in args)) result = client.doMethod(method, params, http_method="GET") print(json.dumps(result, sort_keys=True, indent=2))
def do_request(self, client_id, method, *args): client = self.registry.getClient(client_id) client = ZotonicClient(client) params = dict((a.split("=", 1) for a in args)) result = client.doMethod(method, params, http_method="GET") print(json.dumps(result, sort_keys=True, indent=2))