diff --git a/dingtalk_stream/card_replier.py b/dingtalk_stream/card_replier.py index d33eb61..1f95094 100644 --- a/dingtalk_stream/card_replier.py +++ b/dingtalk_stream/card_replier.py @@ -686,7 +686,7 @@ def finish(self, card_instance_id: str, card_data: dict): card_data_with_status["flowStatus"] = AICardStatus.FINISHED self.put_card_data(card_instance_id, card_data_with_status) - async def finish(self, card_instance_id: str, card_data: dict): + async def async_finish(self, card_instance_id: str, card_data: dict): """ AI卡片执行完成的接口,整体更新 :param card_instance_id: diff --git a/dingtalk_stream/stream.py b/dingtalk_stream/stream.py index e8fddc9..58306d4 100644 --- a/dingtalk_stream/stream.py +++ b/dingtalk_stream/stream.py @@ -22,12 +22,12 @@ from .frames import EventMessage from .frames import CallbackMessage from .log import setup_default_logger -from .utils import get_dingtalk_endpoint +from .utils import DINGTALK_OPENAPI_ENDPOINT from .version import VERSION_STRING class DingTalkStreamClient(object): - OPEN_CONNECTION_API = get_dingtalk_endpoint() + '/v1.0/gateway/connections/open' + OPEN_CONNECTION_API = DINGTALK_OPENAPI_ENDPOINT + '/v1.0/gateway/connections/open' TAG_DISCONNECT = 'disconnect' def __init__(self, credential: Credential, logger: logging.Logger = None): @@ -198,7 +198,7 @@ def get_access_token(self): 'appSecret': self.credential.client_secret, } try: - url = get_dingtalk_endpoint() + '/v1.0/oauth2/accessToken' + url = DINGTALK_OPENAPI_ENDPOINT + '/v1.0/oauth2/accessToken' response_text = '' response = requests.post(url, headers=request_headers, diff --git a/dingtalk_stream/utils.py b/dingtalk_stream/utils.py index 82bcdd4..e7e3935 100644 --- a/dingtalk_stream/utils.py +++ b/dingtalk_stream/utils.py @@ -2,10 +2,7 @@ import os -DINGTALK_OPENAPI_ENDPOINT = "https://api.dingtalk.com" +DINGTALK_OPENAPI_ENDPOINT = os.getenv( + "DINGTALK_OPENAPI_ENDPOINT", "https://api.dingtalk.com" +) -def get_dingtalk_endpoint(): - endpoint_env = os.getenv('DINGTALK_OPENAPI_ENDPOINT') - if endpoint_env: - return endpoint_env - return DINGTALK_OPENAPI_ENDPOINT diff --git a/dingtalk_stream/version.py b/dingtalk_stream/version.py index 9524922..804fead 100644 --- a/dingtalk_stream/version.py +++ b/dingtalk_stream/version.py @@ -1 +1 @@ -VERSION_STRING = '0.22.0' +VERSION_STRING = '0.22.1'