未验证 提交 e6520f49 编写于 作者: T TeslaZhao 提交者: GitHub

Merge pull request #22 from PaddlePaddle/develop

Develop
...@@ -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.
先完成此消息的编辑!
想要评论请 注册