-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGtConfig.py
More file actions
102 lines (80 loc) · 3.06 KB
/
GtConfig.py
File metadata and controls
102 lines (80 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
__author__ = 'Administrator'
import os
class GtConfig:
def __init__(self):
pass
@staticmethod
def isPushSingleBatchAsync():
return os.getenv("gexin_pushSingleBatch_needAsync", False)
@staticmethod
def isPushListAsync():
return os.getenv("gexin_pushList_needAsync", False)
@staticmethod
def isPushListNeedDetails():
return GtConfig.getProperty("gexin_pushList_needDetails", "needDetails", False)
@staticmethod
def getHttpProxyIp():
return os.getenv("gexin_http_proxy_ip", None)
@staticmethod
def getHttpProxyPort():
return os.getenv("gexin_http_proxy_port", 80)
@staticmethod
def getSyncListLimit():
return os.getenv("gexin_pushList_syncLimit", 1000)
@staticmethod
def getAsyncListLimit():
return os.getenv("gexin_pushList_asyncLimit", 10000)
@staticmethod
def getHttpConnectionTimeOut():
return os.getenv("gexin_http_connection_timeout", 60)
@staticmethod
def getHttpSoTimeOut():
return os.getenv("gexin_http_so_timeout", 30)
@staticmethod
def getHttpTryCount():
return os.getenv("gexin_http_tryCount", 3)
@staticmethod
def getHttpInspectInterval():
return os.getenv("gexin_http_inspect_interval", 60)
@staticmethod
def getDefaultDomainUrl(useSSL):
hosts = list()
host = os.getenv("gexin_default_domainurl", None)
if host is None or "" == host.strip():
if useSSL :
hosts.append("https://cncapi.getui.com/serviceex")
hosts.append("https://telapi.getui.com/serviceex")
hosts.append("https://api.getui.com/serviceex")
hosts.append("https://sdk1api.getui.com/serviceex")
hosts.append("https://sdk2api.getui.com/serviceex")
hosts.append("https://sdk3api.getui.com/serviceex")
else:
hosts.append("http://sdk.open.api.igexin.com/serviceex")
hosts.append("http://sdk.open.api.gepush.com/serviceex")
hosts.append("http://sdk.open.api.getui.net/serviceex")
hosts.append("http://sdk1.open.api.igexin.com/serviceex")
hosts.append("http://sdk2.open.api.igexin.com/serviceex")
hosts.append("http://sdk3.open.api.igexin.com/serviceex")
else:
for h in host.split(','):
if h.startswith("https://") and not useSSL:
continue
if h.startswith("http://") and useSSL:
continue
if not h.startswith("http") and useSSL:
h = "https://" + h
hosts.append(h)
return hosts
@staticmethod
def getSDKVersion():
return "4.0.1.0"
@staticmethod
def getProperty(oldKey, newKey, defaultValue):
newValue = os.getenv(newKey)
oldValue = os.getenv(oldKey)
if newValue is not None:
return newValue
elif oldValue is not None:
return oldValue
else:
return defaultValue