Skip to content

Instantly share code, notes, and snippets.

@thpham
Forked from sboily/xivo_services.py
Created May 18, 2016 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thpham/d3c40afeb08d736183668fa9422d13ea to your computer and use it in GitHub Desktop.
Save thpham/d3c40afeb08d736183668fa9422d13ea to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from xivo_auth_client import Client as Auth
from xivo_confd_client import Client as Confd
auth = Auth('127.0.0.1', username='sylvain', password='sylvain', verify_certificate=False)
token_data = auth.token.new('xivo_user', expiration=10)
token = token_data['token']
uuid = token_data['xivo_user_uuid']
confd = Confd('127.0.0.1', port=9486, verify_certificate=False, token=token)
confd.users(uuid).update_service('dnd', {'enabled': True})
print confd.users(uuid).list_services()
confd.users(uuid).update_service('dnd', {'enabled': False})
confd.users(uuid).update_forward('unconditional', {'enabled': True, 'destination': '1234'})
print confd.users(uuid).list_forwards()
confd.users(uuid).update_forward('unconditional', {'enabled': False})
auth.token.revoke(token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment