-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
from requests import post as POST | ||
from json import loads | ||
|
||
|
||
class SpamCheck(): | ||
|
||
postmark_spamcheck_url = "http://spamcheck.postmarkapp.com/filter" | ||
def postmark_spamcheck(self,message, options): | ||
data = {'email':message,'options':options} | ||
result = POST(self.postmark_spamcheck_url,data) | ||
|
||
def postmark_spamcheck(self, message, options): | ||
data = {'email': message, 'options': options} | ||
result = POST(self.postmark_spamcheck_url, data) | ||
result.raise_for_status() | ||
content = loads(result.content) | ||
if 'error' in content: | ||
raise Exception(content['message']) | ||
return content | ||
|
||
|
||
def GetScore(self,email): | ||
results = self.postmark_spamcheck(email,"short") | ||
|
||
def GetScore(self, email): | ||
results = self.postmark_spamcheck(email, "short") | ||
return results['score'] | ||
def GetReport(self,email): | ||
results = self.postmark_spamcheck(email,"long") | ||
return results['report'] | ||
|
||
def GetReport(self, email): | ||
results = self.postmark_spamcheck(email, "long") | ||
return results['report'] |