图引擎服务 GES-认证方式:Token认证

时间:2024-11-25 17:24:28

Token认证

参数authToken和graphEndpoint如何填写见初始化参数获取

from gesgraphsdk.v1.gesgraph_client import GESGraphClient  # 内存版客户端
from gesgraphsdk.v1.persistence.gesgraphpersistence_client import GESGraphPersistenceClient  # 持久化版客户端
from gesgraphsdk.v1.token_credentials import GesGraphTokenCredentials
from huaweicloudsdkcore.http.http_config import HttpConfig


graph_endpoint = "{graphEndpoint}"
token = "{authToken}"
auth = GesGraphTokenCredentials(token=token)
http_conf = HttpConfig.get_default_config()

# 内存版客户端
ges_graph_client = GESGraphClient.new_builder().with_credentials(auth).with_endpoint(graph_endpoint).with_http_config(http_conf).build()
# 持久化版客户端
ges_graph_persistence_client GESGraphPersistenceClient.new_builder().with_credentials(auth).with_endpoint(graph_endpoint).with_http_config(http_conf).build();
support.huaweicloud.com/devg-ges/ges_05_0039.html