def __init__(self, config,storeEndpoint, arbiterEndpoint, storetype, enableLogging): self.config = config self.zestEndpoint = storeEndpoint self.zestDealerEndpoint = storeEndpoint.replace(":5555", ":5556") self.zestCli = zestClient.PyZestClient(config.CORE_STORE_KEY, self.zestEndpoint,self.zestDealerEndpoint, enableLogging) self.arbiterCli = arbiterClient.new_arbiter_client(arbiterEndpoint, enableLogging) self.storetype = storetype
def __init__(self, storeEndpoint, arbiterEndpoint, enableLogging): self.zestEndpoint = storeEndpoint self.zestDealerEndpoint = storeEndpoint.replace(":5555", ":5556") print(config.CORE_STORE_KEY) self.zestCli = zestClient.PyZestClient(config.CORE_STORE_KEY, self.zestEndpoint,self.zestDealerEndpoint, enableLogging) print(self.zestCli) #arbiterCli = arbiterClient(arbiterEndpoint, enableLogging) self.arbiterCli = arbiterClient.new_arbiter_client(arbiterEndpoint, enableLogging) self.storeCli = coreStoreClient.newStoreClient(config, self.zestEndpoint, self.zestDealerEndpoint, self.zestCli, self.arbiterCli) print("client " + str(self.storeCli) )
def setUp(self): self.zc = pythonzestclient.PyZestClient(CORE_STORE_KEY,zestEndpoint,zestDealerEndpoint)
import pythonzestclient import sys, getopt zestEndpoint="tcp://127.0.0.1:5555" zestDealerEndpoint="tcp://127.0.0.1:5556" CORE_STORE_KEY="vl6wu0A@XP?}Or/&BR#LSxn>A+}L)p44/W[wXL3<" tokenString=b"secrete" client = pythonzestclient.PyZestClient(CORE_STORE_KEY,zestEndpoint,zestDealerEndpoint) cmd = input("input request > ") while cmd != 'exit()': args = cmd.split() if args[0] == 'get': try: contentFormat, path = args[1:3] print(f"Sending {args[0]} request...") # request example: get json /kv/test/key print("Response: ", client.get(path, contentFormat,tokenString)) except: print("ERROR: wrong number of arguments") elif args[0] == 'post': try: contentFormat, path, payLoad = args[1:4] print(f"Sending {args[0]} request...") # request example: post json /kv/test/key "{\"name\":\"tosh\",\"age\":38}"} print("Response: ", client.post(path, payLoad, contentFormat, tokenString)) except: