Commit 9be80fc2 authored by Abhilash Raj's avatar Abhilash Raj

* remove contact_address for domains and add owners

* add methods add_owner and remove_all_owners
parent 7050985f
......@@ -199,13 +199,14 @@ class Client:
return _Page(self._connection, 'users', _User, count, page)
def create_domain(self, mail_host, base_url=None,
description=None, contact_address=None):
# `contact_address` is deprecated but still accepted.
description=None, owners=None):
data = dict(mail_host=mail_host)
if base_url is not None:
data['base_url'] = base_url
if description is not None:
data['description'] = description
if owners is not None:
data[owners] = owners
response, content ='domains', data)
return _Domain(self._connection, response['location'])
......@@ -278,9 +279,13 @@ class _Domain:
return self._info['base_url']
def contact_address(self):
return self._info['contact_address']
def owners(self):
url = self._url + '/owners'
response, content =
if 'entries' not in content:
return []
return [item for item in content['entries']]
def description(self):
......@@ -313,6 +318,22 @@ class _Domain:
'lists', dict(fqdn_listname=fqdn_listname))
return _List(self._connection, response['location'])
# def remove_owner(self, owner):
# TODO: add this when API supports it.
# pass
def remove_all_owners(self):
url = self._url + '/owners'
response, content =
url, method='DELETE')
return response
def add_owner(self, owner):
url = self._url + '/owners'
response, content =
url, {'owner': owner})
class _List:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment