Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 846c846645
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (24 sloc) 0.919 kB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 by Lele Long <schemacs@gmail.com>
# This file is free software, distributed under the GPL License.
#
# akismet api test
#
import akismet
defaultkey = r'YOUR-AKISMET-KEY'
pageurl = "http://schemacs.wordpress.com/"
defaultagent = r'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4'
def isspam(comment, author, ipaddress, agent=defaultagent, apikey=defaultkey):
akismet.USERAGENT = agent
try:
valid = akismet.verify_key(apikey, pageurl)
if valid:
return akismet.comment_check(apikey, pageurl, ipaddress, agent, comment_content=comment, comment_author_email=author, comment_type="comment")
else:
print "Invalid key"
return False
except akismet.AkismetError, e:
print e.response, e.statuscode
return False
Jump to Line
Something went wrong with that request. Please try again.