-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
40 lines (32 loc) · 1.09 KB
/
test.py
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
import alim_wrapper as alim
import admin_config
import template_manager as tpl
import json
import time
greetingCode = "TB_7754"
if __name__ == "__main__":
# initial Setting for authentication
alim.initSetting(admin_config.apiKey, admin_config.senderKey, admin_config.userId)
alim.tokenSetting(alim.getToken(1))
# traverse template list and save as json file
templateList = alim.listTemplates()
for t in templateList:
tpl.saveTemplate(t)
tpl.saveVariableList(t)
# get template from ./Template/code.json file and rendering
t = tpl.loadTemplate(greetingCode)
v = tpl.loadVariableList(greetingCode)
inputV = ["user name"]
msg = tpl.RenderTemplate(t, v, inputV)
# send alim talk
sendInfo = alim.getSendInfo(sender="XXXXXXXXXXX", receiver_1="00000000000")
sendResult = alim.sendAlimTalk(sendInfo, msg)
# wait for k
time.sleep(3)
alim.getDetailHistory(sendResult["mid"])
"""example for another func
alim.authChannel("@neo_2020", "01083118428")
alim.getCategory()
alim.listHistory()
alim.listChannel()
"""