-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_request.py
More file actions
51 lines (41 loc) · 1.01 KB
/
batch_request.py
File metadata and controls
51 lines (41 loc) · 1.01 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
#!/usr/bin/env python3
import pythonzimbra.communication
from pythonzimbra.communication import Communication
import pythonzimbra.tools
from pythonzimbra.tools import auth
# url of your zimbra server.
url = 'https://your.server.tld:7071/service/admin/soap'
comm = Communication(url)
user = 'john.doe@domain.tld'
preauth_key = '12345678901234567890...'
usr_token = auth.authenticate(
url,
user,
preauth_key,
)
requests_id = []
info_request = comm.gen_request(token=usr_token)
batch_request = comm.gen_request(token=usr_token, set_batch=True)
requests_id.append(batch_request.add_request(
'GetFolderRequest',
{
'folder': {
'path': '/inbox'
}
},
'urn:zimbraMail'
)
)
requests_id.append(batch_request.add_request(
'GetFolderRequest',
{
'folder': {
'path': '/sent'
}
},
'urn:zimbraMail'
)
)
batch_response = comm.send_request(batch_request)
for request_id in requests_id:
print(batch_response.get_response(request_id))