Akismet 1.1版Python模块。

python-akismet的Python项目详细描述


Latest Travis CI build statusLatest PyPI versionPython versionsCode ClimateTest coverageRequirements Status

python akismet

三叉戟。支持旧版本的python和改进。

支持的api

当前支持以下Akismet API调用:

  • 注释检查
  • 提交火腿
  • 提交垃圾邮件

不支持的API

以下Akismet API调用尚不受支持: *密钥验证

安装

  1. 注册Akismet并在http://akismet.com/plans/获得一个API密钥(不需要付费)

  2. 安装此库:

    pip install python-akismet
    
  3. 打几个电话给Akismet(请参阅下面的示例开始)

示例

导入并实例化Akismet。

fromakismetimportAkismet# API KEY (first argument) is required. blog can be defined later.akismet=Akismet('1ba29d6f120c',blog="http://your.blog/url",application_user_agent="My Application Name/0.0.1")

注释检查

akismet.check('192.168.1.3','Firefox / COMMENT USER AGENT',comment_author='King Arthur',comment_author_email='arthur@camelot.co.uk',comment_author_url='http://camelot.co.uk',comment_content='The Lady of the Lake, her arm clad in the purest shimmering samite, ''held aloft Excalibur from the bosom of the water, signifying by divine'' providence that I, Arthur, was to carry Excalibur. That is why I ''am your king.',referrer='http://camelot-search/?q=Peasant+Woman')

提交火腿

akismet.submit_ham('192.168.1.12','FIREFOX / COMMENT USER AGENT',comment_author='Tim',comment_author_email='tim@witch.co.uk',comment_author_url='http://witch.co.uk',comment_content="Look, that rabbit's got a vicious streak a mile wide!""It's a killer!")

提交垃圾邮件

akismet.submit_spam('192.168.1.4','FIREFOX / COMMENT USER AGENT',comment_author='Frenchman',comment_author_email='frenchman@guy-de-lombard.fr',comment_author_url='http://guy-de-lombard.fr',comment_content="You don't frighten us, English pig-dogs! Go and boil your ""bottoms, sons of a silly person! I blow my nose at you, ""so-called Ah-thoor Keeng, you and all your silly English ""K-n-n-n-n-n-n-n-niggits!")

文档

上面的例子向你展示了你需要知道的一切。

有关每个api调用支持的参数的完整列表,请参见http://akismet.com/development/api/

反正代码只有大约100行,所以如果你不确定什么东西的话,就看看“akismet”。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
tomcat Java条带错误   java OPENTSDB fsck修复程序不更正重复点   java JavaFX在控制器内切换自身的可见性   java maven surefire插件未并行执行运行程序   读取导致Freemarker模板引擎中TemplateException的Java对象   无法使Java库与我的Android应用程序一起工作   安卓 java。lang.IllegalStateException游标   使用Java检索XML文件中的XSL URL和名称   java如何从文本文件集合中提取特定值   电子邮件java mail gmail   java为什么finalize()只被垃圾收集器调用一次?   java方法findViewById(int)对于Json类型是未定义的。蛇形   java在安卓中尝试从brother打印机打印位图时遇到以下异常   java在颤振中支持Kotlin的优势   java从后面编写文本   java制作列表。第一个列表可以有相同的数字,第二个将是价格,尝试制作第三个列表,如果它们是相同的数字,它将添加价格