4.3.2.5. Contact¶
-
class
dyn.tm.accounts.
Contact
(nickname, *args, **kwargs)[source]¶ A DynECT System Contact
-
__init__
(nickname, *args, **kwargs)[source]¶ Create a
Contact
objectParameters: - nickname – The nickname for this
Contact
- email – The
Contact
‘s email address - first_name – The
Contact
‘s first name - last_name – The
Contact
‘s last name - organization – The
Contact
‘s organization - phone – The
Contact
‘s phone number. Can be of the form: ( 0 ) ( country-code ) ( local number ) ( extension ) Only the country-code (1-3 digits) and local number (at least 7 digits) are required. The extension can be up to 4 digits. Any non-digits are ignored. - address – The
Contact
‘s street address - address2 – The
Contact
‘s street address, line 2 - city – The
Contact
‘s city, part of the user’s address - country – The
Contact
‘s country, part of theContact
‘s address - fax – The
Contact
‘s fax number - notify_email – Email address where the
Contact
should receive notifications - pager_email – Email address where the
Contact
should receive messages destined for a pager - post_code – Zip code or Postal code
- state – The
Contact
‘s state, part of theContact
‘s address - website – The
Contact
‘s website
- nickname – The nickname for this
-
post_code
¶ This
Contacts
‘s postal code, part of the contacts’s address
-
4.3.2.5.1. Contact Examples¶
The following examples highlight how to use the Contact
class to
get/create Contact
‘s on the dyn.tm System and how to edit these
objects from within a Python script.
4.3.2.5.1.1. Creating a new Contact¶
The following example shows how to create a new Contact
on the dyn.tm
System and how to edit some of the fields using the returned Contact
object.
>>> from dyn.tm.accounts import Contact
>>> # Create a dyn.tmSession
>>> new_contact = Contact('mynickname', 'me@email.com', 'firstname',
... 'lastname', 'MyOrganization')
>>> new_contact.city
None
>>> new_contact.city = 'Manchester'
>>> new_contact.city
u'Manchester'
4.3.2.5.1.2. Getting an Existing Contact¶
The following example shows how to get an existing Contact
from the
dyn.tm System and how to edit some of the same fields mentioned above. It is
also probably worth mentioning that when a User
is created a
Contact
is also created and is associated with that User
.
However, when a User
is deleted the associated Contact
is not
deleted along with it, as it may still be associated with active services.
>>> from dyn.tm.accounts import Contact
>>> # Create a dyn.tmSession
>>> my_contact = Contact('mynickname')
>>> my_contact.email
u'me@email.com'
>>> my_contact.email = 'mynewemail@email.com'
>>> my_contact.email
u'mynewemail@email.com'