Skip to main content
CI status image

A Python interface to the Akismet spam-filtering service.

Two API clients are available from this library:

  • akismet.SyncClient is an Akismet API client which performs synchronous (blocking) HTTP requests to the Akismet web service.

  • akismet.AsyncClient is an Akismet API client which performs asynchronous (async/await/non-blocking) HTTP requests to the Akismet web service.

Aside from one being sync and the other async, the two clients expose identical APIs, and implement all methods of the Akismet web API.

To use this library, you will need to obtain an Akismet API key and register a site for use with the Akismet web service; you can do this at <https://akismet.com>. Once you have a key and corresponding registered site URL to use with it, place them in the environment variables PYTHON_AKISMET_API_KEY and PYTHON_AKISMET_BLOG_URL, and they will be automatically detected and used.

You can then construct a client instance and call its methods. It’s recommended that you always use a client construction method which will automatically validate your API key with the Akismet web service. You can do this by creating your client as a context manager, in which case the key is automatically validated on entering the with block:

import akismet

with akismet.SyncClient() as akismet_client:
    if akismet_client.comment_check(
        user_ip=submitter_ip,
        comment_content=submitted_content,
        comment_type="forum-post",
        comment_author=submitter_name
    ):
        # This piece of content was classified as spam; handle it appropriately.

Or using the asynchronous client:

import akismet

async with akismet.AsyncClient() as akismet_client:
    if await akismet_client.comment_check(
        user_ip=submitter_ip,
        comment_content=submitted_content,
        comment_type="forum-post",
        comment_author=submitter_name
    ):
        # This piece of content was classified as spam; handle it appropriately.

Or you can use the validated_client() constructor method, which will validate your key when constructing the client instance:

import akismet

akismet_client = akismet.SyncClient.validated_client()

if akismet_client.comment_check(
    user_ip=submitter_ip,
    comment_content=submitted_content,
    comment_type="forum-post",
    comment_author=submitter_name
):
    # This piece of content was classified as spam; handle it appropriately.

Or using the asynchronous client:

import akismet

akismet_client = await akismet.AsyncClient.validated_client()

if await akismet_client.comment_check(
    user_ip=submitter_ip,
    comment_content=submitted_content,
    comment_type="forum-post",
    comment_author=submitter_name
):
    # This piece of content was classified as spam; handle it appropriately.

See the documentation for full details.

The original version of this library was written by Michael Foord.

Release files for akismet 25.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for akismet 25.10.1
File Size Uploaded
akismet-25.10.1.tar.gz 63.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for akismet 25.10.1
File Interpreter ABI Platform
akismet-25.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 88.0 kB

Release files / akismet-25.10.1.tar.gz

Download URL akismet-25.10.1.tar.gz
Size 63.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d5e5a4e9e3fe83618acc2315e6d8aa68e9cbd8a24814442293cd9cd1fbc3c119
BLAKE2b-256 checksum
How to use checksums
b85a9ec894c6aa82c8b6c478757c68508376005ffe58cb417327f173b9a08e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.0 CPython/3.13.0

Release files / akismet-25.10.1-py3-none-any.whl

Download URL akismet-25.10.1-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf12225b289976d6bb5d6fca89573be97199cfca723ed199ddc75f5d7beaf55c
BLAKE2b-256 checksum
How to use checksums
94c779a5d82fb74692c8db29ae058640d1fa44858a81960d37f99690800f7141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

25.10.1 This release

2 release files

24.5.1

2 release files

24.5.0

2 release files

1.3

2 release files

1.2.1

2 release files

1.2

2 release files

1.1

2 release files

1.0.1

2 release files

1.0

2 release files

0.2.0

1 release file

0.1.4

0.1.3

0.1.2

0.1.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page