File tree Expand file tree Collapse file tree 4 files changed +8
-25
lines changed Expand file tree Collapse file tree 4 files changed +8
-25
lines changed Original file line number Diff line number Diff line change 1010
1111client = sendgrid .SendGridAPIClient (os .environ .get ('SENDGRID_API_KEY' ))
1212
13+ """
14+
1315email = 'elmer.thomas+test_global0@gmail.com'
1416status, msg = client.asm_global_suppressions.delete(email)
1517print status
1618print msg
1719
18- """
19-
2020status, msg = client.suppressions.get()
2121print status
2222print msg
3838print status
3939print msg
4040
41- status, msg = client.asm_groups.get()
42- print status
43- print msg
44-
4541status, msg = client.asm_groups.post("Magic Key", "Unlock your Emails")
4642print status
4743print msg
Original file line number Diff line number Diff line change @@ -35,18 +35,18 @@ def client(self):
3535 return self ._client
3636
3737 # Determine if an email belongs to the global suppression group
38- def get (self , email = None ):
38+ def get (self , email ):
3939 self ._endpoint = self ._base_endpoint + '/' + email
4040 return self .client .get (self )
4141
4242 # Add an email to the global suppressions group
43- def post (self , emails = None ):
43+ def post (self , emails ):
4444 self ._endpoint = self ._base_endpoint
4545 data = {}
4646 data ["recipient_emails" ] = emails
4747 return self .client .post (self , data )
4848
4949 # Remove an email from the global suppressions group
50- def delete (self , email = None ):
50+ def delete (self , email ):
5151 self ._endpoint = self ._base_endpoint + '/' + email
5252 return self .client .delete (self )
Original file line number Diff line number Diff line change @@ -39,19 +39,8 @@ def client(self):
3939 def get (self , id = None ):
4040 if id == None :
4141 return self .client .get (self )
42-
43- if isinstance (id , int ):
42+ else :
4443 self ._endpoint = self ._base_endpoint + "/" + str (id )
45- return self .client .get (self )
46-
47- if len (id ) > 1 :
48- count = 0
49- for i in id :
50- if count == 0 :
51- self ._endpoint = self ._endpoint + "?id=" + str (i )
52- else :
53- self ._endpoint = self ._endpoint + "&id=" + str (i )
54- count = count + 1
5544
5645 return self .client .get (self )
5746
Original file line number Diff line number Diff line change @@ -36,10 +36,8 @@ def client(self):
3636 return self ._client
3737
3838 # Get suppressed addresses for a given group id.
39- def get (self , id = None ):
40- if isinstance (id , int ):
41- self ._endpoint = self ._base_endpoint + "/" + str (id ) + "/suppressions"
42- return self .client .get (self )
39+ def get (self , id ):
40+ self ._endpoint = self ._base_endpoint + "/" + str (id ) + "/suppressions"
4341 return self .client .get (self )
4442
4543 # Add recipient addresses to the suppressions list for a given group.
You can’t perform that action at this time.
0 commit comments