|
12 | 12 |
|
13 | 13 | from volcenginesdkcore.rest import ApiException |
14 | 14 | from ._exceptions import ArkAPIError |
15 | | - |
| 15 | +from ._models import BaseModel |
16 | 16 | import volcenginesdkark |
17 | 17 |
|
18 | 18 | from . import resources |
@@ -378,11 +378,12 @@ def _load_api_key( |
378 | 378 | return resp.api_key, resp.expired_time |
379 | 379 |
|
380 | 380 |
|
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.""" |
385 | 384 |
|
| 385 | + |
| 386 | +class E2ECertificateManager(object): |
386 | 387 | def __init__( |
387 | 388 | self, |
388 | 389 | ak: str, |
@@ -450,13 +451,13 @@ def _sync_load_cert_by_auth(self, ep: str) -> str: |
450 | 451 | self._e2e_uri, |
451 | 452 | options={"headers": self._x_session_token}, |
452 | 453 | body={"model": ep}, |
453 | | - cast_to=self.CertificateResponse, |
| 454 | + cast_to=CertificateResponse, |
454 | 455 | ) |
455 | 456 | except Exception as e: |
456 | 457 | raise ArkAPIError("Getting Certificate failed: %s\n" % e) |
457 | 458 | if "error" in resp: |
458 | 459 | raise ArkAPIError("Getting Certificate failed: %s\n" % resp["error"]) |
459 | | - return resp["Certificate"] |
| 460 | + return resp.Certificate |
460 | 461 |
|
461 | 462 | def _save_cert_to_file(self, ep: str, cert_pem: str): |
462 | 463 | cert_file_path = os.path.join(self._cert_storage_path, f"{ep}.pem") |
|
0 commit comments