Commit ef9a4827 authored by Barry Warsaw's avatar Barry Warsaw

get_domain()

parent a9cdbd88
......@@ -156,6 +156,11 @@ class Client:
response, content = self._connection.call('domains', data)
return _Domain(self._connection, response['location'])
def get_domain(self, email_host):
response, content = self._connection.call(
'domains/{0}'.format(email_host))
return _Domain(self._connection, content['self_link'])
class _Domain:
......
......@@ -33,8 +33,8 @@ must be added. By default, there are no known domains.
>>> client.domains
[]
It's easy to create a new domain, and when you do, a proxy object for that
domain is returned.
It's easy to create a new domain; when you do, a proxy object for that domain
is returned.
>>> example_dot_com = client.create_domain('example.com')
>>> example_dot_com
......@@ -49,3 +49,18 @@ domain is returned.
example.com
>>> print example_dot_com.url_host
example.com
You can also get an existing domain independently.
>>> example = client.get_domain('example.com')
>>> example
<Domain "example.com">
>>> print example_dot_com.base_url
http://example.com
But you cannot retrieve a non-existent domain.
>>> client.get_domain('example.org')
Traceback (most recent call last):
...
HTTPError: HTTP Error 404: 404 Not Found
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