Akismet

raw JSON →
25.10.1 verified Fri May 01 auth: no python

A Python interface to the Akismet spam-filtering service. Current version 25.10.1 requires Python >=3.10 and uses httpx for async HTTP. Releases follow a calendar versioning scheme with monthly updates.

pip install akismet
error ModuleNotFoundError: No module named 'akismet'
cause Package not installed or installed in wrong environment.
fix
Run 'pip install akismet' in the correct Python environment (check Python version >=3.10).
error ValueError: user_ip is required
cause The check() method needs keyword argument 'user_ip'.
fix
Add user_ip='<IP>' to the call, e.g., akismet.check(user_ip='127.0.0.1', ...)
error AttributeError: module 'akismet' has no attribute 'AkismetClient'
cause The class was renamed; 'AkismetClient' does not exist in akismet v25.
fix
Use 'from akismet import Akismet' (note: no 'Client').
breaking Akismet v25 drops support for Python <3.10. Upgrade Python or pin to older version (e.g., akismet==24.12.1).
fix Use Python 3.10+ or pip install 'akismet<25'
breaking The synchronous client is now async-free but uses httpx under the hood. If you were using the old 'requests'-based interface, you must update imports and calls.
fix Replace 'from akismet import AkismetClient' with 'from akismet import Akismet' and ensure httpx is installed.
gotcha The check() method requires user_ip and user_agent to be provided; omitting them will raise a ValueError.
fix Always pass user_ip and user_agent to check().
deprecated The old synchronous API using requests library is deprecated since v25. Use the new httpx-based client.
fix Switch to the new Akismet class. See quickstart.

Initialize with API key and blog URL, then call check() to test a comment.

import os
from akismet import Akismet

api_key = os.environ.get('AKISMET_API_KEY', '')
blog_url = 'https://your-blog.example.com'

akismet = Akismet(api_key=api_key, blog_url=blog_url)

# Check comment
is_spam = akismet.check(
    user_ip='127.0.0.1',
    user_agent='Mozilla/5.0',
    comment_author='viagra-test',
    comment_content='Spam message here'
)
print(f'Spam: {is_spam}')