class documentation

class MailingList(RESTObject): (source)

View In Hierarchy

Undocumented

Method __init__ No summary
Method __repr__ Undocumented
Method accept_message Shortcut for moderate_message.
Method accept_request Shortcut to accept a subscription request.
Method add_moderator Add a list moderator.
Method add_owner Add a list owner.
Method add_role Add a new Member with a specific role.
Method archivers.setter Undocumented
Method defer_message Shortcut for moderate_message.
Method defer_request Shortcut to defer a subscription request.
Method discard_message Shortcut for moderate_message.
Method discard_request Shortcut to discard a subscription request.
Method find_members Find a Mailinglist's members.
Method get_bans_page Get a paginated list of bans for this MailingList.
Method get_held_count Get a count of held messages for the MailingList.
Method get_held_message Get a single held message for MailingList.
Method get_held_page Paginated list of held messages for the MailingList.
Method get_member Get a Member of the list.
Method get_member_page Return a paginated list of MailingList's members.
Method get_nonmember Get a non-member of the list.
Method get_request Get an individual pending request for the given token.
Method get_requests Return a list of dicts with subscription requests.
Method get_requests_count Return a total count of pending subscription requests.
Method get_roster Get roster of the MailingList.
Method is_member Given an address, checks if the given address is subscribed to this mailing list.
Method is_moderator Given an address, checks if the given address is a moderator of this mailing list.
Method is_owner Given an address, checks if the given address is an owner of this mailing list.
Method is_owner_or_mod Given an address, checks if the given address is either a owner or a moderator of this list.
Method manage_request Alias for moderate_request, kept for compatibility
Method mass_unsubscribe Unsubscribe a list of emails from a mailing list.
Method moderate_message Moderate a held message.
Method moderate_request Moderate a subscription request.
Method reject_message Shortcut for moderate_message.
Method reject_request Shortcut to reject a subscription request.
Method remove_moderator Remove a list moderator.
Method remove_owner Remove a list owner.
Method remove_role Remove a list Member with a specific Role.
Method set_template Set a MailingList template URI.
Method subscribe Subscribe an email address to a mailing list.
Method unsubscribe Unsubscribe an email address from a mailing list.
Property archivers Get a list of MailingList archivers.
Property bans A list of banned addresses for this MailingList.
Property header_matches A list of header-match rules for the MailingList.
Property held Held messages of a MailingList..
Property members All MailingList members.
Property moderators All MailingList moderators.
Property nonmembers All MailingList non-members.
Property owners All MailingList owners.
Property requests See get_requests.
Property settings All MailingList settings.
Property templates Get a list of MailingList templates.
Property unsubscription_requests Get a list of subscription requests pending moderator Approval.
Method _check_membership Given an address and role, check if there is a membership record that matches the given address with a given role for this Mailing List.
Method _get_membership Get a single membership resource.
Class Variable _properties Undocumented
Instance Variable _settings Undocumented

Inherited from RESTObject:

Method __getattr__ Undocumented
Method __setattr__ Undocumented
Method delete Undocumented

Inherited from RESTBase (via RESTObject):

Method save Undocumented
Property rest_data Get data from API and cache it (only once per instance).
Method _get Undocumented
Method _reset_cache Undocumented
Method _set Undocumented
Class Variable _autosave automatically send a PATCH request to the API when a value is changed. Otherwise, the save() method must be called.
Class Variable _read_only_properties list of properties that cannot be written to (defaults to self_link only).
Class Variable _writable_properties list of properties that can be written to using a PATCH request. If this value is None, all properties are writable.
Instance Variable _changed_rest_data Undocumented
Instance Variable _connection Undocumented
Instance Variable _rest_data Undocumented
Instance Variable _url Undocumented
def __init__(self, connection, url, data=None): (source)
Parameters
connection:Connection.An API connection object.
url:str.The url of the API endpoint.
data:dict.The initial data to use.
def __repr__(self): (source)
def accept_message(self, request_id): (source)

Shortcut for moderate_message.

Parameters
request_idUndocumented
str request_idThe request_id of the held message.
def accept_request(self, request_id): (source)

Shortcut to accept a subscription request.

def add_moderator(self, address, display_name=None): (source)

Add a list moderator.

Parameters
addressUndocumented
display_nameUndocumented
str addressEmail address of the moderator.
str display_nameDisplay name of the moderator.
def add_owner(self, address, display_name=None): (source)

Add a list owner.

Parameters
addressUndocumented
display_nameUndocumented
str addressEmail address of the owner.
str display_nameDisplay name of the Owner.
def add_role(self, role, address, display_name=None): (source)

Add a new Member with a specific role.

Parameters
roleUndocumented
addressUndocumented
display_nameUndocumented
str roleThe role for the new member.
str addressA valid email address for the new Member.
str display_nameAn optional display name for the Member.
@archivers.setter
def archivers(self, new_value): (source)

Undocumented

def defer_message(self, request_id): (source)

Shortcut for moderate_message.

Parameters
request_idUndocumented
str request_idThe request_id of the held message.
def defer_request(self, request_id): (source)

Shortcut to defer a subscription request.

def discard_message(self, request_id): (source)

Shortcut for moderate_message.

Parameters
request_idUndocumented
str request_idThe request_id of the held message.
def discard_request(self, request_id): (source)

Shortcut to discard a subscription request.

def find_members(self, address=None, role=None, page=None, count=50): (source)

Find a Mailinglist's members.

This provides a filtering API for list's Members including, non-members, owners and moderators by speciying the role.

Parameters
addressUndocumented
roleUndocumented
pageUndocumented
countUndocumented
str addressMember's address.
str roleMember's role.
int pagePage number for paginated results.
int countNumber of results per-page for paginated results.
def get_bans_page(self, count=50, page=1): (source)

Get a paginated list of bans for this MailingList.

Parameters
countUndocumented
pageUndocumented
int pagePage number for paginated results.
int countNumber of results per-page for paginated results.
def get_held_count(self): (source)

Get a count of held messages for the MailingList.

def get_held_message(self, held_id): (source)

Get a single held message for MailingList.

Parameters
held_idUndocumented
int held_idHeld message id to get.
def get_held_page(self, count=50, page=1): (source)

Paginated list of held messages for the MailingList.

Parameters
countUndocumented
pageUndocumented
int pagePage number for paginated results.
int countNumber of results per-page for paginated results.
def get_member(self, email): (source)

Get a Member of the list.

Parameters
emailUndocumented
addressThe email address of the member for this list.
Returns
A member proxy object.
def get_member_page(self, count=50, page=1, fields=None): (source)

Return a paginated list of MailingList's members.

Parameters
countUndocumented
pageUndocumented
fieldsUndocumented
int countCount of members in one page.
int pageThe page number.
def get_nonmember(self, email): (source)

Get a non-member of the list.

Parameters
emailUndocumented
addressThe email address of the non-member for this list.
Returns
A member proxy object.
def get_request(self, token): (source)

Get an individual pending request for the given token.

Parameters
tokenThe token for the request.
Returns
The request dictionary.
def get_requests(self, token_owner=None, request_type='subscription'): (source)

Return a list of dicts with subscription requests.

This is the new API for requests which allows filtering via token_owner since it isn't possible to do so via the property requests.

Parameters
token_ownerWho owns the pending requests? Should be one in 'no_one', 'moderator' and 'subscriber'.
request_typeThe type of pending request. Value should be in 'subscription' or 'unsubscription'. Defaults to 'subscription'.
def get_requests_count(self, token_owner=None): (source)

Return a total count of pending subscription requests.

This should be a faster query when all the requests aren't needed and only a count is needed to display on the badge in List's settings page.

Parameters
token_ownerWho owns the pending requests? Should be one in 'no_one', 'moderator' and 'subscriber'.
Returns
The count of pending requests.
def get_roster(self, roster, fields=None): (source)

Get roster of the MailingList.

If the fields is specified without self_link and address, they are added since it is required for returning the response.

Parameters
rosterUndocumented
fieldsUndocumented
str rosterOne of the Membership rosters from 'owner', 'moderator', 'member' and 'nonmember'.
List[str] fieldsList of Member's fields to fetch from the API. Skipping certain fields can speed up the API response when they aren't required since they need to be fetched from database individually.
def is_member(self, address): (source)

Given an address, checks if the given address is subscribed to this mailing list.

def is_moderator(self, address): (source)

Given an address, checks if the given address is a moderator of this mailing list.

def is_owner(self, address): (source)

Given an address, checks if the given address is an owner of this mailing list.

def is_owner_or_mod(self, address): (source)

Given an address, checks if the given address is either a owner or a moderator of this list.

It is possible for them to be both owner and moderator.

def manage_request(self, token, action): (source)

Alias for moderate_request, kept for compatibility

def mass_unsubscribe(self, email_list): (source)

Unsubscribe a list of emails from a mailing list.

This function return a json of emails mapped to booleans based on whether they were unsubscribed or not, for whatever reasons

Parameters
email_listlist of emails to unsubscribe
def moderate_message(self, request_id, action, comment=None): (source)

Moderate a held message.

Parameters
request_id:Int.Id of the held message.
action:String.Action to perform on held message.
comment:strThe reason for action, only supported for rejection.
def moderate_request(self, request_id, action, reason=None): (source)

Moderate a subscription request.

Parameters
request_idUndocumented
action:str.accept|reject|discard|defer
reason:strThe reason associated with rejections.
def reject_message(self, request_id, reason=None): (source)

Shortcut for moderate_message.

Parameters
request_idUndocumented
reasonUndocumented
str request_idThe request_id of the held message.
str reasonAn optional reason for rejection of the message.
def reject_request(self, request_id): (source)

Shortcut to reject a subscription request.

def remove_moderator(self, address): (source)

Remove a list moderator.

Parameters
addressUndocumented
str addressEmail address of the moderator to remove.
def remove_owner(self, address): (source)

Remove a list owner.

Parameters
addressUndocumented
str addressEmail address of the owner to remove.
def remove_role(self, role, address): (source)

Remove a list Member with a specific Role.

Parameters
roleUndocumented
addressUndocumented
str roleThe role for the new member.
str addressA valid email address for the new Member.
def set_template(self, template_name, uri, username=None, password=None): (source)

Set a MailingList template URI.

Parameters
template_nameUndocumented
uriUndocumented
usernameUndocumented
passwordUndocumented
str template_nameThe name of the template.
str uriThe URI to fetch the template.
str usernameUsername for fetching template from uri.
str passwordPassword for fetching template from uri.
def subscribe(self, address, display_name=None, pre_verified=False, pre_confirmed=False, pre_approved=False, invitation=False, send_welcome_message=None, delivery_mode=None, delivery_status=None): (source)

Subscribe an email address to a mailing list.

Parameters
address:strEmail address to subscribe to the list.
display_name:strThe real name of the new member.
pre_verified:boolTrue if the address has been verified.
pre_confirmed:boolTrue if membership has been approved by the user.
pre_approved:boolTrue if membership is moderator-approved.
invitation:boolTrue if this is an invitation to join the list.
send_welcome_message:boolTrue if welcome message should be sent.
delivery_mode:str. One between'regular', 'plaintext_digests', 'mime_digests', 'summary_digests'.Delivery mode of the Member.
delivery_status:str. One between'enabled', 'by_owner', 'by_moderator', 'by_user'.Delivery status of the Member.
Returns
A member proxy object.
def unsubscribe(self, email, pre_confirmed=None, pre_approved=None): (source)

Unsubscribe an email address from a mailing list.

Parameters
emailUndocumented
pre_confirmed:boolTrue if unsubscribe is approved by the user.
pre_approved:boolTrue if unsubscribe is moderator-approved.
address:strEmail address to unsubscribe.
@property
archivers = (source)

Get a list of MailingList archivers.

@property
bans = (source)

A list of banned addresses for this MailingList.

@property
header_matches = (source)

A list of header-match rules for the MailingList.

@property
held = (source)

Held messages of a MailingList..

@property
members = (source)

All MailingList members.

@property
moderators = (source)

All MailingList moderators.

@property
nonmembers = (source)

All MailingList non-members.

@property
owners = (source)

All MailingList owners.

@property
requests = (source)
@property
settings = (source)

All MailingList settings.

@property
templates = (source)

Get a list of MailingList templates.

@property
unsubscription_requests = (source)

Get a list of subscription requests pending moderator Approval.

def _check_membership(self, address, allowed_roles): (source)

Given an address and role, check if there is a membership record that matches the given address with a given role for this Mailing List.

def _get_membership(self, email, role): (source)

Get a single membership resource.

Parameters
emailUndocumented
roleThe membership role.
addressThe email address of the member for this list.
Returns
A member proxy object.
_properties: tuple[str, ...] = (source)
_settings = (source)

Undocumented