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 22
22
from .frames import EventMessage
23
23
from .frames import CallbackMessage
24
24
from .log import setup_default_logger
25
- from .utils import DINGTALK_OPENAPI_ENDPOINT
25
+ from .utils import get_dingtalk_endpoint
26
26
from .version import VERSION_STRING
27
27
28
28
29
29
class 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'
31
31
TAG_DISCONNECT = 'disconnect'
32
32
33
33
def __init__ (self , credential : Credential , logger : logging .Logger = None ):
@@ -191,7 +191,8 @@ def get_access_token(self):
191
191
'appSecret' : self .credential .client_secret ,
192
192
}
193
193
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 ,
195
196
headers = request_headers ,
196
197
data = json .dumps (values ))
197
198
response .raise_for_status ()
Original file line number Diff line number Diff line change 1
1
# -*- coding:utf-8 -*-
2
2
3
+ import os
4
+
3
5
DINGTALK_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