@@ -22,7 +22,7 @@ def get(self, list_id=None, email_address=None, include_tracking_preference=Fals
2222 (list_id or self .list_id ), params = params )
2323 return json_to_py (response )
2424
25- def add (self , list_id , email_address , name , custom_fields , resubscribe , consent_to_track , restart_subscription_based_autoresponders = False ):
25+ def add (self , list_id , email_address , name , custom_fields , resubscribe , consent_to_track , restart_subscription_based_autoresponders = False , mobile_number = False , consent_to_track_sms = "Unchanged" ):
2626 """Adds a subscriber to a subscriber list."""
2727 validate_consent_to_track (consent_to_track )
2828 body = {
@@ -32,11 +32,17 @@ def add(self, list_id, email_address, name, custom_fields, resubscribe, consent_
3232 "Resubscribe" : resubscribe ,
3333 "ConsentToTrack" : consent_to_track ,
3434 "RestartSubscriptionBasedAutoresponders" : restart_subscription_based_autoresponders }
35+
36+ if mobile_number :
37+ body ["MobileNumber" ] = mobile_number
38+ validate_consent_to_track (consent_to_track_sms )
39+ body ["ConsentToSendSms" ] = consent_to_track_sms
40+
3541 response = self ._post ("/subscribers/%s.json" %
3642 list_id , json .dumps (body ))
3743 return json_to_py (response )
3844
39- def update (self , new_email_address , name , custom_fields , resubscribe , consent_to_track , restart_subscription_based_autoresponders = False ):
45+ def update (self , new_email_address , name , custom_fields , resubscribe , consent_to_track , restart_subscription_based_autoresponders = False , mobile_number = False , consent_to_track_sms = "Unchanged" ):
4046 """Updates any aspect of a subscriber, including email address, name, and
4147 custom field data if supplied."""
4248 validate_consent_to_track (consent_to_track )
@@ -48,6 +54,12 @@ def update(self, new_email_address, name, custom_fields, resubscribe, consent_to
4854 "Resubscribe" : resubscribe ,
4955 "ConsentToTrack" : consent_to_track ,
5056 "RestartSubscriptionBasedAutoresponders" : restart_subscription_based_autoresponders }
57+
58+ if mobile_number :
59+ body ["MobileNumber" ] = mobile_number
60+ validate_consent_to_track (consent_to_track_sms )
61+ body ["ConsentToSendSms" ] = consent_to_track_sms
62+
5163 response = self ._put ("/subscribers/%s.json" % self .list_id ,
5264 body = json .dumps (body ), params = params )
5365 # Update self.email_address, so this object can continue to be used
@@ -93,4 +105,4 @@ def delete(self):
93105 """Moves this subscriber to the deleted state in the associated list."""
94106 params = {"email" : self .email_address }
95107 response = self ._delete ("/subscribers/%s.json" %
96- self .list_id , params = params )
108+ self .list_id , params = params )
0 commit comments