Once you have
akismet installed, you can begin
using it as soon as you register an API key and a site to use it on.
Obtaining an API key¶
akismet requires an Akismet API key, and requires
associating that API key with the site you’ll use
on. Visit akismet.com to purchase an API key
and associate it with a site.
Optional arguments to API methods¶
For API methods other than
verify_key(), only the end
user’s IP address and user-agent string are required to be passed as
arguments (a third argument,
blog, will be automatically inserted
for you). However, these methods all accept a large set of optional
keyword arguments, corresponding to additinoal data accepted by the
Akismet web service. This set of arguments is identical across all the
Akismet recommends sending as many of these arguments as possible, as additional data helps with identification of spam and training the service.
For a full list of the supported arguments, see the Akismet web service documentation.
The most commonly useful arguments are:
comment_author– a string containing the name or username of the person posting the comment.
comment_content– a string containing the contents of the commant.
comment_type– a string indicating the type of comment. For typical site comments, set this to
"comment". For a contact form, use
"contact-form". For a user-account signup, use
To represent different possible error conditions,
several exception classes:
Base class for all exceptions directly raised by
akismet. Other exceptions may still occur (for example, due to network unavailability or timeout), and will not be caught by
akismetor replaced with this exception.
AkismetErrorindicating an unexpected or non-standard response was received from the Akismet web service. The message raised with this exception will include the API method invoked, and the contents of the unexpected response.
AkismetErrorindicating that the supplied configuration is missing or invalid. The message raised with this exception will provide details of the problem.
ConfigurationErrorto indicate the specific case of an invalid API key.