[spam-stopper] Python API

Phillip Pearson pp at myelin.co.nz
Tue Nov 29 20:54:55 UTC 2005


It shouldn't be too hard to write a Python interface directly to
akismet; the details are all in the PHP code.


Here are the functions you need to implement:

- function akismet_verify_key($key)

  This does an HTTP post to http://rest.akismet.com/1.1/verify-key
  with arguments {'key': api_key, 'blog': blog_url}.  If the key is
  valid, it will return 'valid'.

- function ksd_auto_check_comment($comment)

  This does an HTTP post to http://rest.akismet.com/1.1/comment-check
  with the following things in the argument space:

  - all $_SERVER vars (these are basically the CGI environment vars -
    REMOTE_ADDR etc).  Run <?phpinfo()?> in PHP to see what these are.

  - 'user_ip': ip address of caller
    'user_agent': http user agent
    'referrer': http referrer
    'blog': blog url

  - everything else in $comment

  This returns 'true' if the comment is classified as spam.

- function ksd_submit_nonspam_comment

  This does an HTTP post to http://rest.akismet.com/1.1/submit-ham
  with arguments {'blog': blog url} plus all the columns in the
  wp_comments row for the particular comment.

- function ksd_submit_spam_comment

  As above, but submits a comment as spam, not ham.  (URL is
  http://rest.akismet.com/1.1/submit-spam).


That's about it...

Cheers,
Phil


On Tue, Nov 29, 2005 at 01:13:34PM +0000, Fuzzyman wrote:
> Hello,
> 
> I have a problem with guestbook spam and I'd like to look at Akismet as
> a possible solution. I'm a Python programmer and happy to implement my
> own interface to Akismet given the details.
> 
> Guestbook : http://www.voidspace.org.uk/cgi-bin/voidspace/guestbook2.py
> Blog entry on the problem :
> http://www.voidspace.org.uk/python/weblog/arch_d7_2005_11_26.shtml#e144
> 
> I've already  have several solutions in place, and have just
> investigated adding a DNS blacklist lookup. Using three or four
> blacklists it would only stop around fifty percent of my spam. :-(
> 
> Anyway, familiar problem. I've downloaded akismet and got myself a
> Wordpress API key.
> 
> It turns out that Akismet is a php script... The development pages on
> the website point to this mailing list. :-)
> 
> I'm happy to either implement a Python interface to the php script (?)
> *or* a Python interface direct to the Akismet API. (And make the result
> freely available under an open source license if you want...)
> 
> Are you happy to give me the details to do this ?
> 
> All the best,
> 
> 
> Fuzzyman
> http://www.voidsspace.org.uk/python/index.shtml
> _______________________________________________
> spam-stopper mailing list
> spam-stopper at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/spam-stopper



More information about the spam-stopper mailing list