diff --git a/python/paddle_serving_client/__init__.py b/python/paddle_serving_client/__init__.py index 4c9a9dead2bc55d56526a2fd18229509bf52f9c7..a00fd298dab2d8e20b57e7a2605af9944bf615c4 100644 --- a/python/paddle_serving_client/__init__.py +++ b/python/paddle_serving_client/__init__.py @@ -198,12 +198,12 @@ class Client(object): self.rpc_timeout_ms = rpc_timeout def use_key(self, key_filename): - with open(key_filename, "r") as f: + with open(key_filename, "rb") as f: self.key = f.read() def get_serving_port(self, endpoints): if self.key is not None: - req = json.dumps({"key": base64.b64encode(self.key)}) + req = json.dumps({"key": base64.b64encode(self.key).decode()}) else: req = json.dumps({}) r = requests.post("http://" + endpoints[0], req)