Skip to content

Commit 5a2fc8b

Browse files
author
潘婉宁
committed
fix: CertificateResponse
1 parent 0eb1214 commit 5a2fc8b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

volcenginesdkarkruntime/_client.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from volcenginesdkcore.rest import ApiException
1414
from ._exceptions import ArkAPIError
15-
15+
from ._models import BaseModel
1616
import volcenginesdkark
1717

1818
from . import resources
@@ -378,11 +378,12 @@ def _load_api_key(
378378
return resp.api_key, resp.expired_time
379379

380380

381-
class E2ECertificateManager(object):
382-
class CertificateResponse:
383-
Certificate: str
384-
"""The certificate content."""
381+
class CertificateResponse(BaseModel):
382+
Certificate: str
383+
"""The certificate content."""
385384

385+
386+
class E2ECertificateManager(object):
386387
def __init__(
387388
self,
388389
ak: str,
@@ -450,13 +451,13 @@ def _sync_load_cert_by_auth(self, ep: str) -> str:
450451
self._e2e_uri,
451452
options={"headers": self._x_session_token},
452453
body={"model": ep},
453-
cast_to=self.CertificateResponse,
454+
cast_to=CertificateResponse,
454455
)
455456
except Exception as e:
456457
raise ArkAPIError("Getting Certificate failed: %s\n" % e)
457458
if "error" in resp:
458459
raise ArkAPIError("Getting Certificate failed: %s\n" % resp["error"])
459-
return resp["Certificate"]
460+
return resp.Certificate
460461

461462
def _save_cert_to_file(self, ep: str, cert_pem: str):
462463
cert_file_path = os.path.join(self._cert_storage_path, f"{ep}.pem")

0 commit comments

Comments
 (0)