akismet


Nameakismet JSON
Version 24.11.0 PyPI version JSON
download
home_pageNone
SummaryA Python interface to the Akismet spam-filtering service.
upload_time2024-11-10 09:12:31
maintainerJames Bennett
docs_urlNone
authorMichael Foord, James Bennett
requires_python>=3.9
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. For
creating a long-lived API client instance, it's recommended that you
use the ``validated_client()`` constructor method, which will
automatically validate your API key with the Akismet web service. For
example, to check a submitted forum post for spam:

.. 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.

.. 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.



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.9",
    "maintainer_email": null,
    "keywords": "akismet, spam, spam-filtering",
    "author": "Michael Foord, James Bennett",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/22/70/07334f7a486adcdf104f1a9e410ee55ef319e8b15bd1d729a4fe411da5f2/akismet-24.11.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\n<https://akismet.com>`_.\n\nTwo API clients are available from this library:\n\n* ``akismet.SyncClient`` is an Akismet API client which performs\n  synchronous (blocking) HTTP requests to the Akismet web service.\n\n* ``akismet.AsyncClient`` is an Akismet API client which performs\n  asynchronous (``async``/``await``/non-blocking) HTTP requests to the\n  Akismet web service.\n\nAside from one being sync and the other async, the two clients expose\nidentical APIs, and implement all methods of `the Akismet web API\n<https://akismet.com/developers/>`_.\n\nTo use this library, you will need to obtain an Akismet API key and\nregister a site for use with the Akismet web service; you can do this\nat <https://akismet.com>. Once you have a key and corresponding\nregistered site URL to use with it, place them in the environment\nvariables ``PYTHON_AKISMET_API_KEY`` and ``PYTHON_AKISMET_BLOG_URL``,\nand they will be automatically detected and used.\n\nYou can then construct a client instance and call its methods. For\ncreating a long-lived API client instance, it's recommended that you\nuse the ``validated_client()`` constructor method, which will\nautomatically validate your API key with the Akismet web service. For\nexample, to check a submitted forum post for spam:\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\n*not* require the ``validated_client()`` constructor, because your API\nkey is validated on entering the ``with`` block.\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\n\n\nSee `the documentation <http://akismet.readthedocs.io/>`_ for full\ndetails.\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": "24.11.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": "5397db5cc80072d74820a0f366fcb28a9a3bcb0144b59abafe48a3035d7bee1b",
                "md5": "177db3ec4877451ff47f9ae1f4d57e26",
                "sha256": "bee9e9b6b2a8a87c7b41feb9f3c855e3a33fe2923696cfef685da87abf662dee"
            },
            "downloads": -1,
            "filename": "akismet-24.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "177db3ec4877451ff47f9ae1f4d57e26",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 25797,
            "upload_time": "2024-11-10T09:12:29",
            "upload_time_iso_8601": "2024-11-10T09:12:29.912108Z",
            "url": "https://files.pythonhosted.org/packages/53/97/db5cc80072d74820a0f366fcb28a9a3bcb0144b59abafe48a3035d7bee1b/akismet-24.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "227007334f7a486adcdf104f1a9e410ee55ef319e8b15bd1d729a4fe411da5f2",
                "md5": "41732a61002d17f2ef1c48b6094133af",
                "sha256": "1fefa05e6500a8b41c43bd1dbff8e04a6c76cc16d217981075d70673731244bd"
            },
            "downloads": -1,
            "filename": "akismet-24.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "41732a61002d17f2ef1c48b6094133af",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 54086,
            "upload_time": "2024-11-10T09:12:31",
            "upload_time_iso_8601": "2024-11-10T09:12:31.109596Z",
            "url": "https://files.pythonhosted.org/packages/22/70/07334f7a486adcdf104f1a9e410ee55ef319e8b15bd1d729a4fe411da5f2/akismet-24.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-10 09:12:31",
    "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.36299s