Skip to content

Commit f2715cf

Browse files
author
liuhuiqi.7
committed
feat(e2e): volc sync bp change
Change-Id: I00a7c9bfa6406bfea26a21805c52e60d70387973
1 parent f2e802c commit f2715cf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

volcenginesdkarkruntime/_client.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,6 @@ def __init__(self, ak: str, sk: str, region: str, base_url: str | URL = BASE_URL
344344

345345
# api instance prepare
346346
import volcenginesdkcore
347-
self._api_instance_enabled = True
348-
if ak is None or sk is None:
349-
self._api_instance_enabled = False
350347
configuration = volcenginesdkcore.Configuration()
351348
configuration.ak = ak
352349
configuration.sk = sk
@@ -359,11 +356,14 @@ def __init__(self, ak: str, sk: str, region: str, base_url: str | URL = BASE_URL
359356
self.cert_path = os.environ.get("E2E_CERTIFICATE_PATH")
360357

361358
# ark client prepare
362-
self.client = Ark(
363-
base_url=base_url,
364-
api_key=api_key,
365-
ak=ak, sk=sk,
366-
)
359+
self._ark_client_enabled = True
360+
if api_key is None:
361+
self._ark_client_enabled = False
362+
else:
363+
self.client = Ark(
364+
base_url=base_url,
365+
api_key=api_key,
366+
)
367367
self._e2e_uri = "/e2e/get/certificate"
368368
self._x_session_token = {'X-Session-Token': self._e2e_uri}
369369

@@ -425,10 +425,10 @@ def get(self, ep: str) -> key_agreement_client:
425425
if cert_pem is None:
426426
if self.cert_path is not None:
427427
cert_pem = self._load_cert_by_cert_path()
428-
elif self._api_instance_enabled:
429-
cert_pem = self._load_cert_by_ak_sk(ep)
430-
else:
428+
elif self._ark_client_enabled:
431429
cert_pem = self._sync_load_cert_by_auth(ep)
430+
else:
431+
cert_pem = self._load_cert_by_ak_sk(ep)
432432
self._save_cert_to_file(ep, cert_pem)
433433
self._certificate_manager[ep] = key_agreement_client(
434434
certificate_pem_string=cert_pem

0 commit comments

Comments
 (0)