Skip to content

Commit 3ad2795

Browse files
author
wangjiaju
committed
Add ark veauth bp
1 parent 51fc0d9 commit 3ad2795

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

veadk/auth/veauth/ark_veauth.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ def get_ark_token(region: str = "cn-beijing") -> str:
3535
secret_key = cred.secret_access_key
3636
session_token = cred.session_token
3737

38+
provider = os.getenv("CLOUD_PROVIDER")
39+
host = "open.volcengineapi.com"
40+
if provider and provider.lower() == "byteplus":
41+
region = "ap-southeast-1"
42+
host = "open.byteplusapi.com"
43+
3844
res = ve_request(
3945
request_body={"ProjectName": "default", "Filter": {"AllowAll": True}},
4046
header={"X-Security-Token": session_token},
@@ -44,8 +50,9 @@ def get_ark_token(region: str = "cn-beijing") -> str:
4450
service="ark",
4551
version="2024-01-01",
4652
region=region,
47-
host="open.volcengineapi.com",
53+
host=host,
4854
)
55+
logger.info(f"Successfully fetched ARK API Key list: {res}")
4956
try:
5057
first_api_key_id = res["Result"]["Items"][0]["Id"]
5158
logger.warning("By default, VeADK fetches the first API Key in the list.")
@@ -65,7 +72,7 @@ def get_ark_token(region: str = "cn-beijing") -> str:
6572
service="ark",
6673
version="2024-01-01",
6774
region=region,
68-
host="open.volcengineapi.com",
75+
host=host,
6976
)
7077
try:
7178
api_key = res["Result"]["ApiKey"]

0 commit comments

Comments
 (0)