akismet


Nameakismet JSON
Version 25.10.0 PyPI version JSON
download
home_pageNone
SummaryA Python interface to the Akismet spam-filtering service.
upload_time2025-10-20 06:21:27
maintainerJames Bennett
docs_urlNone
authorMichael Foord, James Bennett
requires_python>=3.10
licenseBSD-3-Clause
keywords akismet spam spam-filtering
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. -*-restructuredtext-*-

.. image:: https://github.com/ubernostrum/akismet/workflows/CI/badge.svg
   :alt: CI status image
   :target: https://github.com/ubernostrum/akismet/actions?query=workflow%3ACI

A Python interface to `the Akismet spam-filtering service <https://akismet.com>`_.

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 <https://akismet.com/developers/>`_.

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:

.. code-block:: python

   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:

.. code-block:: python

   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:

.. code-block:: python

   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:

.. code-block:: python

   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.

You can also use either client class as a context manager. This does *not* require the
``validated_client()`` constructor, because your API key is validated on entering the
``with`` block.

See `the documentation <http://akismet.readthedocs.io/>`_ for full details.

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "akismet",
    "maintainer": "James Bennett",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "akismet, spam, spam-filtering",
    "author": "Michael Foord, James Bennett",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/31/a9/a14028417e8b3a875b61ffd63f1b6d51048c0409fe2bed450701dec3a9a1/akismet-25.10.0.tar.gz",
    "platform": null,
    "description": ".. -*-restructuredtext-*-\n\n.. image:: https://github.com/ubernostrum/akismet/workflows/CI/badge.svg\n   :alt: CI status image\n   :target: https://github.com/ubernostrum/akismet/actions?query=workflow%3ACI\n\nA Python interface to `the Akismet spam-filtering service <https://akismet.com>`_.\n\nTwo API clients are available from this library:\n\n* ``akismet.SyncClient`` is an Akismet API client which performs synchronous (blocking)\n  HTTP requests to the Akismet web service.\n\n* ``akismet.AsyncClient`` is an Akismet API client which performs asynchronous\n  (``async``/``await``/non-blocking) HTTP requests to the Akismet web service.\n\nAside from one being sync and the other async, the two clients expose identical APIs,\nand implement all methods of `the Akismet web API <https://akismet.com/developers/>`_.\n\nTo use this library, you will need to obtain an Akismet API key and register a site for\nuse with the Akismet web service; you can do this at <https://akismet.com>. Once you\nhave a key and corresponding registered site URL to use with it, place them in the\nenvironment variables ``PYTHON_AKISMET_API_KEY`` and ``PYTHON_AKISMET_BLOG_URL``, and\nthey will be automatically detected and used.\n\nYou can then construct a client instance and call its methods. It's recommended that you\nalways use a client construction method which will automatically validate your API key\nwith the Akismet web service. You can do this by creating your client as a context\nmanager, in which case the key is automatically validated on entering the ``with``\nblock:\n\n.. code-block:: python\n\n   import akismet\n\n   with akismet.SyncClient() as akismet_client:\n       if akismet_client.comment_check(\n           user_ip=submitter_ip,\n           comment_content=submitted_content,\n           comment_type=\"forum-post\",\n           comment_author=submitter_name\n       ):\n           # This piece of content was classified as spam; handle it appropriately.\n\nOr using the asynchronous client:\n\n.. code-block:: python\n\n   import akismet\n\n   async with akismet.AsyncClient() as akismet_client:\n       if await akismet_client.comment_check(\n           user_ip=submitter_ip,\n           comment_content=submitted_content,\n           comment_type=\"forum-post\",\n           comment_author=submitter_name\n       ):\n           # This piece of content was classified as spam; handle it appropriately.\n\nOr you can use the ``validated_client()`` constructor method, which will validate your\nkey when constructing the client instance:\n\n.. code-block:: python\n\n   import akismet\n\n   akismet_client = akismet.SyncClient.validated_client()\n\n   if akismet_client.comment_check(\n       user_ip=submitter_ip,\n       comment_content=submitted_content,\n       comment_type=\"forum-post\",\n       comment_author=submitter_name\n   ):\n       # This piece of content was classified as spam; handle it appropriately.\n\nOr using the asynchronous client:\n\n.. code-block:: python\n\n   import akismet\n\n   akismet_client = await akismet.AsyncClient.validated_client()\n\n   if await akismet_client.comment_check(\n       user_ip=submitter_ip,\n       comment_content=submitted_content,\n       comment_type=\"forum-post\",\n       comment_author=submitter_name\n   ):\n       # This piece of content was classified as spam; handle it appropriately.\n\nYou can also use either client class as a context manager. This does *not* require the\n``validated_client()`` constructor, because your API key is validated on entering the\n``with`` block.\n\nSee `the documentation <http://akismet.readthedocs.io/>`_ for full details.\n\nThe original version of this library was written by Michael Foord.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A Python interface to the Akismet spam-filtering service.",
    "version": "25.10.0",
    "project_urls": {
        "Documentation": "https://akismet.readthedocs.io",
        "Source Code": "https://github.com/ubernostrum/akismet"
    },
    "split_keywords": [
        "akismet",
        " spam",
        " spam-filtering"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b34b86c5c299a6e20421a3ea169134cecfec3fe25e653ee215194e392200ebf",
                "md5": "7b447b18b6720e1416ced267b344a2d0",
                "sha256": "0e9fe9502bb5e7f345b3687fd867bbd0e826ad728b978a8948f9530927e89eb6"
            },
            "downloads": -1,
            "filename": "akismet-25.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7b447b18b6720e1416ced267b344a2d0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 25011,
            "upload_time": "2025-10-20T06:21:25",
            "upload_time_iso_8601": "2025-10-20T06:21:25.383831Z",
            "url": "https://files.pythonhosted.org/packages/9b/34/b86c5c299a6e20421a3ea169134cecfec3fe25e653ee215194e392200ebf/akismet-25.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "31a9a14028417e8b3a875b61ffd63f1b6d51048c0409fe2bed450701dec3a9a1",
                "md5": "35979e9704ffba4bfe64e79f2500d505",
                "sha256": "28032b6b4f7c679fe828290e46d2ad9c2d0a7d20ea0a514a35de5ee9f6e69458"
            },
            "downloads": -1,
            "filename": "akismet-25.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "35979e9704ffba4bfe64e79f2500d505",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 63143,
            "upload_time": "2025-10-20T06:21:27",
            "upload_time_iso_8601": "2025-10-20T06:21:27.105405Z",
            "url": "https://files.pythonhosted.org/packages/31/a9/a14028417e8b3a875b61ffd63f1b6d51048c0409fe2bed450701dec3a9a1/akismet-25.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-20 06:21:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ubernostrum",
    "github_project": "akismet",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "akismet"
}
        
Elapsed time: 0.69625s