Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions example_v3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

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

"""

email = 'elmer.thomas+test_global0@gmail.com'
status, msg = client.asm_global_suppressions.delete(email)
print status
print msg

"""

status, msg = client.suppressions.get()
print status
print msg
Expand All @@ -38,10 +38,6 @@
print status
print msg

status, msg = client.asm_groups.get()
print status
print msg

status, msg = client.asm_groups.post("Magic Key", "Unlock your Emails")
print status
print msg
Expand Down
6 changes: 3 additions & 3 deletions sendgrid/resources/asm_global_suppressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ def client(self):
return self._client

# Determine if an email belongs to the global suppression group
def get(self, email=None):
def get(self, email):
self._endpoint = self._base_endpoint + '/' + email
return self.client.get(self)

# Add an email to the global suppressions group
def post(self, emails=None):
def post(self, emails):
self._endpoint = self._base_endpoint
data = {}
data["recipient_emails"] = emails
return self.client.post(self, data)

# Remove an email from the global suppressions group
def delete(self, email=None):
def delete(self, email):
self._endpoint = self._base_endpoint + '/' + email
return self.client.delete(self)
13 changes: 1 addition & 12 deletions sendgrid/resources/asm_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,8 @@ def client(self):
def get(self, id=None):
if id == None:
return self.client.get(self)

if isinstance(id, int):
else:
self._endpoint = self._base_endpoint + "/" + str(id)
return self.client.get(self)

if len(id) > 1:
count = 0
for i in id:
if count == 0:
self._endpoint = self._endpoint + "?id=" + str(i)
else:
self._endpoint = self._endpoint + "&id=" + str(i)
count = count + 1

return self.client.get(self)

Expand Down
6 changes: 2 additions & 4 deletions sendgrid/resources/asm_suppressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ def client(self):
return self._client

# Get suppressed addresses for a given group id.
def get(self, id=None):
if isinstance(id, int):
self._endpoint = self._base_endpoint + "/" + str(id) + "/suppressions"
return self.client.get(self)
def get(self, id):
self._endpoint = self._base_endpoint + "/" + str(id) + "/suppressions"
return self.client.get(self)

# Add recipient addresses to the suppressions list for a given group.
Expand Down