• Akismet

  last modified October 13, 2007 by mrtopf

There is python module for accessing akismet: http://www.voidspace.org.uk/python/akismet_python.html

How it works


Basically you feed it an API-key and a User Agent. Then you post the comment with as much additionally date as you want to it. The more you give the better the decision will be. Usually you should give things like


Example


api = Akismet(agent='Test Script')
# if apikey.txt is in place,
# the key will automatically be set
# or you can call ``api.setAPIKey()``
#
if api.key is None:
print "No 'apikey.txt' file."
elif not api.verify_key():
print "The API key is invalid."
else:
# data should be a dictionary of values
# They can all be filled in with defaults
# from a CGI environment
if api.comment_check(comment, data):
print 'This comment is spam.'
else:
print 'This comment is ham.'
Additionally you can also mark a comment marked as spam as ham.