Name | akismet JSON |
Version |
1.3
JSON |
| download |
home_page | |
Summary | A Python interface to the Akismet spam-filtering service. |
upload_time | 2024-02-20 06:40:14 |
maintainer | |
docs_url | None |
author | Michael Foord |
requires_python | >=3.8 |
license | BSD-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/>`_, including the v1.2 key and API
usage metrics.
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
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.
Note that in both cases the client instance is created via the
alternate constructor ``validated_client()``. This is recommended
instead of using the default constructor (i.e., directly calling
``akismet.SyncClient()`` or ``akismet.AsyncClient()``); the
``validated_client()`` constructor will perform automatic discovery of
the environment-variable configuration and validate the configuration
with the Akismet web service before returning the client, while
directly constructing an instance will not (so if you do directly
construct an instance, you must manually provide and validate its
configuration).
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": "",
"name": "akismet",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "akismet,spam,spam-filtering",
"author": "Michael Foord",
"author_email": "James Bennett <james@b-list.org>",
"download_url": "https://files.pythonhosted.org/packages/f8/8a/b893021d1463aba91b8987d9498609a6128a09c82d74059513cb088261d6/akismet-1.3.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/>`_, including the v1.2 key and API\nusage metrics.\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\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\nNote that in both cases the client instance is created via the\nalternate constructor ``validated_client()``. This is recommended\ninstead of using the default constructor (i.e., directly calling\n``akismet.SyncClient()`` or ``akismet.AsyncClient()``); the\n``validated_client()`` constructor will perform automatic discovery of\nthe environment-variable configuration and validate the configuration\nwith the Akismet web service before returning the client, while\ndirectly constructing an instance will not (so if you do directly\nconstruct an instance, you must manually provide and validate its\nconfiguration).\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": "1.3",
"project_urls": {
"documentation": "https://akismet.readthedocs.io",
"homepage": "https://github.com/ubernostrum/akismet"
},
"split_keywords": [
"akismet",
"spam",
"spam-filtering"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "04ca365f7399b424bf30d4af46d0a7e119fc55bb8587ebb88fe08b4664b48d54",
"md5": "cff71cfecf5003f97b69fa94fb35b38e",
"sha256": "00cd86f04507505d71bc9674feb8b4a809d393fb4b33edbf50508e70b0dcd899"
},
"downloads": -1,
"filename": "akismet-1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cff71cfecf5003f97b69fa94fb35b38e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22311,
"upload_time": "2024-02-20T06:40:12",
"upload_time_iso_8601": "2024-02-20T06:40:12.170260Z",
"url": "https://files.pythonhosted.org/packages/04/ca/365f7399b424bf30d4af46d0a7e119fc55bb8587ebb88fe08b4664b48d54/akismet-1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f88ab893021d1463aba91b8987d9498609a6128a09c82d74059513cb088261d6",
"md5": "d52969ef436bd6af671bdcaae3a1e057",
"sha256": "7c5497cc37f7b7b6fb4ff21c4afcecfe89344db070bda388d76ff66e453cb8c0"
},
"downloads": -1,
"filename": "akismet-1.3.tar.gz",
"has_sig": false,
"md5_digest": "d52969ef436bd6af671bdcaae3a1e057",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 43297,
"upload_time": "2024-02-20T06:40:14",
"upload_time_iso_8601": "2024-02-20T06:40:14.547261Z",
"url": "https://files.pythonhosted.org/packages/f8/8a/b893021d1463aba91b8987d9498609a6128a09c82d74059513cb088261d6/akismet-1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-20 06:40:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ubernostrum",
"github_project": "akismet",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "akismet"
}