垃圾邮件相关服务接口
spam-blocklists的Python项目详细描述
用于验证URL是否已分类为垃圾邮件的库
支持:
- Spamhaus禅
- SURBL MULTI
计划:
- 菲什银行
有关更多信息,您可以在此处观看教程: http://www.youtube.com/watch?v=anwy2MPT5RE
安装
来自PYPI(稳定):
pip install spam-blocklists
来自Github(不稳定):
pip install git+git://github.com/fmarani/spam.git#egg=spam-blocklists
使用
Spamhaus:
>>> from spam.spamhaus import SpamHausChecker >>> checker = SpamHausChecker() # google.com is a good domain >>> checker.is_spam("http://www.google.com/search?q=food") False # this domain does not exist >>> checker.is_spam("http://buyv1agra.com/") Traceback (most recent call last): ... DomainInexistentException # this is a scam >>> checker.is_spam("http://mihouyuan.com/login.htm") True
附加值:
>>> from spam.surbl import SurblChecker >>> checker = SurblChecker() # google.com test >>> checker.is_spam("http://www.google.com/search?q=food") False # spamhaus says it is spam, surbl does not >>> checker.is_spam("http://mihouyuan.com/login.htm") False # test endpoint for surbl >>> checker.is_spam("http://surbl-org-permanent-test-point.com/") True
贡献
克隆并安装测试依赖项:
pip install -r requirements.txt
确保测试通过:
./runtests.sh