File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 2222from .frames import EventMessage
2323from .frames import CallbackMessage
2424from .log import setup_default_logger
25- from .utils import DINGTALK_OPENAPI_ENDPOINT
25+ from .utils import get_dingtalk_endpoint
2626from .version import VERSION_STRING
2727
2828
2929class DingTalkStreamClient (object ):
30- OPEN_CONNECTION_API = DINGTALK_OPENAPI_ENDPOINT + '/v1.0/gateway/connections/open'
30+ OPEN_CONNECTION_API = get_dingtalk_endpoint () + '/v1.0/gateway/connections/open'
3131 TAG_DISCONNECT = 'disconnect'
3232
3333 def __init__ (self , credential : Credential , logger : logging .Logger = None ):
@@ -191,7 +191,8 @@ def get_access_token(self):
191191 'appSecret' : self .credential .client_secret ,
192192 }
193193 try :
194- response = requests .post (DINGTALK_OPENAPI_ENDPOINT + '/v1.0/oauth2/accessToken' ,
194+ url = get_dingtalk_endpoint () + '/v1.0/oauth2/accessToken'
195+ response = requests .post (url ,
195196 headers = request_headers ,
196197 data = json .dumps (values ))
197198 response .raise_for_status ()
Original file line number Diff line number Diff line change 11# -*- coding:utf-8 -*-
22
3+ import os
4+
35DINGTALK_OPENAPI_ENDPOINT = "https://api.dingtalk.com"
6+
7+ def get_dingtalk_endpoint ():
8+ endpoint_env = os .getenv ('DINGTALK_OPENAPI_ENDPOINT' )
9+ if endpoint_env :
10+ return endpoint_env
11+ return DINGTALK_OPENAPI_ENDPOINT
Original file line number Diff line number Diff line change 1- VERSION_STRING = '0.19.1 '
1+ VERSION_STRING = '0.20.0 '
You can’t perform that action at this time.
0 commit comments