-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-operator.py
executable file
·56 lines (44 loc) · 1.29 KB
/
test-operator.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
import kerio.api
import time
from pprint import pprint
client = kerio.api.Client(debug = True, insecure = True, url = 'https://localhost:4021/admin/api/jsonrpc/')
def init():
client.ProductActivation.activate(
adminPassword = "password",
adminLanguage = "en",
adminEmail = "[email protected]",
pbxLanguageId = 2,
pbxStartingNumber = "10",
timeZoneId = "",
reboot = False,
sendClientStatistics = False,
myKerioEnabled = False,
)
#init()
client.Session.login(userName = 'Admin', password = 'password', application = {'name': "", 'vendor': "", 'version': ""})
client.upload('./test-connect.py')
client.SystemBackup.backupCancel()
client.SystemBackup.backupStart(
sections = {
"SYSTEM_DATABASE": True,
"VOICE_MAIL": True,
"SYSTEM_LOG": True,
"CALL_LOG": True,
"LICENSE": True,
"RECORDED_CALLS": True,
"TFTP": True
}
)
while True:
if client.SystemBackup.get()['statusBackup']['STATE'] != 1:
break
time.sleep(1)
backup = client.SystemBackup.backupDownload()["fileDownload"]
for data in client.download(backup["url"]):
pass
client.Session.logout()
try:
client.Session.logout()
except kerio.api.Error as e:
pprint(e)