Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WaitSetRequest #30

Open
vladus06 opened this issue Oct 29, 2020 · 1 comment
Open

WaitSetRequest #30

vladus06 opened this issue Oct 29, 2020 · 1 comment

Comments

@vladus06
Copy link

I'm trying to listen for new emails being added, getting emptiness. How can I view new letters correctly?

info_request = comm.gen_request(token=usr_token)
iinfo_request = comm.gen_request(token=usr_token)


#Create waitset
info_request.add_request(
    'CreateWaitSetRequest',
    {
	'defTypes': 'f,m,c',
	'add': {
		'a': {
		    'name': 'my@mail',
		    'types': 'f,m,c'
		},
	},
	
    },
    'urn:zimbraMail'
)
info_response = comm.send_request(info_request)
if not info_response.is_fault():
    waitset = (info_response.get_response()['CreateWaitSetResponse']['waitSet'])
    seq = (info_response.get_response()['CreateWaitSetResponse']['seq'])
    defTypes = (info_response.get_response()['CreateWaitSetResponse']['defTypes'])
......

everything above works. I get values
{u'CreateWaitSetResponse': {u'waitSet': u'WaitSet-064715ab-1867-4254-ac38-63bfd6255484', u'defTypes': u'f,m,c', u'seq': 0}}

.......
iinfo_request.add_request(
    'WaitSetRequest',
    {
	'waitSet': waitset,
	'seq': seq,
	'block': '1',
	'defTypes': defTypes,
	'timeout': '1000',
	'expand': '1',
	'add': {
		'a': {
		    'name': 'my@mail',
		    'token': '',
		    'types': defTypes
		},
	},
	
    },
    'urn:zimbraMail'
)
iinfo_response = comm.send_request(iinfo_request)
if not iinfo_response.is_fault():
    print (iinfo_response.get_response()['WaitSetResponse'])

I think the problem is here

if not iinfo_response.is_fault():
    print (iinfo_response.get_response()['WaitSetResponse'])

Result:
[root@mail zmadmin]# python ./test.py
[root@mail zmadmin]#

I want to see:
[root@mail zmadmin]# python ./test.py
{u'WaitSetResponse': {u'waitSet': u'WaitSet-064715ab-1867-4254-ac38-63bfd6255484', ... bla-bla-bla
{u'WaitSetResponse': {u'waitSet': u'WaitSet-064715ab-1867-4254-ac38-63bfd6255484', ... bla-bla-bla
{u'WaitSetResponse': {u'waitSet': u'WaitSet-064715ab-1867-4254-ac38-63bfd6255484', ... bla-bla-bla

@vladus06
Copy link
Author

I added values to CreateWaitSetRequest and WaitSetRequest
'token': '401',

Result:
[root@mail zmadmin]# python ./test.py
{u'a': {u'id': u'7ac0ebb7-2bd5-4c48-828c-74cbc0e636d1', u'changeid': 4136}, u'waitSet': u'WaitSet-aadbba9d-1385-4f2b-97a6-a508776ed050', u'seq': u'2', u'error': {u'type': u'ALREADY_IN_SET_DURING_ADD', u'id': u'7ac0ebb7-2bd5-4c48-828c-74cbc0e636d1'}}
[root@mail zmadmin]#

How to listen to messages continuously?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant