提交 9bd890e9 编写于 作者: H HexToString

fix encryption bug real bug is in paddle_serving_client __init__ with open

上级 17e63116
...@@ -198,12 +198,12 @@ class Client(object): ...@@ -198,12 +198,12 @@ class Client(object):
self.rpc_timeout_ms = rpc_timeout self.rpc_timeout_ms = rpc_timeout
def use_key(self, key_filename): def use_key(self, key_filename):
with open(key_filename, "r") as f: with open(key_filename, "rb") as f:
self.key = f.read() self.key = f.read()
def get_serving_port(self, endpoints): def get_serving_port(self, endpoints):
if self.key is not None: if self.key is not None:
req = json.dumps({"key": base64.b64encode(self.key)}) req = json.dumps({"key": base64.b64encode(self.key).decode()})
else: else:
req = json.dumps({}) req = json.dumps({})
r = requests.post("http://" + endpoints[0], req) r = requests.post("http://" + endpoints[0], req)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册