Skip to content

Commit c4cfed1

Browse files
Merge pull request #141 from sendgrid/pythonic
Pythonic
2 parents 2f0e287 + 483e031 commit c4cfed1

File tree

4 files changed

+8
-25
lines changed

4 files changed

+8
-25
lines changed

example_v3_test.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
1212

13+
"""
14+
1315
email = 'elmer.thomas+test_global0@gmail.com'
1416
status, msg = client.asm_global_suppressions.delete(email)
1517
print status
1618
print msg
1719
18-
"""
19-
2020
status, msg = client.suppressions.get()
2121
print status
2222
print msg
@@ -38,10 +38,6 @@
3838
print status
3939
print msg
4040
41-
status, msg = client.asm_groups.get()
42-
print status
43-
print msg
44-
4541
status, msg = client.asm_groups.post("Magic Key", "Unlock your Emails")
4642
print status
4743
print msg

sendgrid/resources/asm_global_suppressions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

sendgrid/resources/asm_groups.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff 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

sendgrid/resources/asm_suppressions.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)