########
aiospamc
########
|pypi| |docs| |license| |unit| |integration| |python|
.. |pypi| image:: https://img.shields.io/pypi/v/aiospamc
:target: https://pypi.org/project/aiospamc/
.. |unit| image:: https://github.com/mjcaley/aiospamc/actions/workflows/unit-tests.yml/badge.svg
:target: https://github.com/mjcaley/aiospamc/actions/workflows/unit-tests.yml
.. |integration| image:: https://github.com/mjcaley/aiospamc/actions/workflows/integration-tests.yml/badge.svg
:target: https://github.com/mjcaley/aiospamc/actions/workflows/integration-tests.yml
.. |docs| image:: https://readthedocs.org/projects/aiospamc/badge/?version=latest
:target: https://aiospamc.readthedocs.io/en/latest/
.. |license| image:: https://img.shields.io/github/license/mjcaley/aiospamc
:target: ./LICENSE
.. |python| image:: https://img.shields.io/pypi/pyversions/aiospamc
:target: https://python.org
**aiospamc** is a client for SpamAssassin that you can use as a library or command line tool.
The implementation is based on asyncio; so you can use it in your applications for asynchronous calls.
The command line interface provides user-friendly access to SpamAssassin server commands and provides both JSON
and user-consumable outputs.
*************
Documentation
*************
Detailed documentation can be found at: https://aiospamc.readthedocs.io/
************
Requirements
************
* Python 3.9 or higher
* `certifi` for updated certificate authorities
* `loguru` for structured logging
* `typer` for the command line interface
********
Examples
********
Command-Line Tool
=================
`aiospamc` is your interface to SpamAssassin through CLI. To submit a message
for a score, use:
.. code-block:: console
# Take the output of gtube.msg and have SpamAssasin return a score
$ cat ./gtube.msg | aiospamc check
1000.0/5.0
# Ping the server
$ aiospamc ping
PONG
Library
=======
.. code-block:: python
import asyncio
import aiospamc
GTUBE = """Subject: Test spam mail (GTUBE)
Message-ID: <GTUBE1.1010101@example.net>
Date: Wed, 23 Jul 2003 23:30:00 +0200
From: Sender <sender@example.net>
To: Recipient <recipient@example.net>
Precedence: junk
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
This is the GTUBE, the
Generic
Test for
Unsolicited
Bulk
Email
If your spam filter supports it, the GTUBE provides a test by which you
can verify that the filter is installed correctly and is detecting incoming
spam. You can send yourself a test mail containing the following string of
characters (in upper case and with no white spaces and line breaks):
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
You should send this test mail from an account outside of your network.
""".encode("ascii")
# Ping the SpamAssassin server
async def is_alive():
pong = await aiospamc.ping()
return True if pong.status_code == 0 else False
asyncio.run(is_alive())
# True
# Get the spam score of a message
async def get_score(message):
response = await aiospamc.check(message)
return response.headers.spam.score, response.headers.spam.threshold
asyncio.run(get_score(GTUBE))
# (1000.0, 5.0)
# List the modified headers
async def list_headers(message):
response = await aiospamc.headers(message)
for line in response.body.splitlines():
print(line.decode())
asyncio.run(list_headers(GTUBE))
# Received: from localhost by DESKTOP.
# with SpamAssassin (version 4.0.0);
# Wed, 30 Aug 2023 20:11:34 -0400
# From: Sender <sender@example.net>
# To: Recipient <recipient@example.net>
# Subject: Test spam mail (GTUBE)
# Date: Wed, 23 Jul 2003 23:30:00 +0200
# Message-Id: <GTUBE1.1010101@example.net>
# X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on DESKTOP.
# X-Spam-Flag: YES
# X-Spam-Level: **************************************************
# X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE,NO_RECEIVED,
# NO_RELAYS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no
# version=4.0.0
# MIME-Version: 1.0
# Content-Type: multipart/mixed; boundary="----------=_64EFDAB6.3640FAEF"
Raw data
{
"_id": null,
"home_page": "https://github.com/mjcaley/aiospamc",
"name": "aiospamc",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "spam, spamc, spamassassin",
"author": "Michael Caley",
"author_email": "mjcaley@darkarctic.com",
"download_url": "https://files.pythonhosted.org/packages/8a/f7/4ae0daa1e59823232aeb88cc48f0c2d61779b04270af0630c78c2c6dd11b/aiospamc-1.1.1.tar.gz",
"platform": null,
"description": "########\naiospamc\n########\n\n|pypi| |docs| |license| |unit| |integration| |python|\n\n.. |pypi| image:: https://img.shields.io/pypi/v/aiospamc\n :target: https://pypi.org/project/aiospamc/\n\n.. |unit| image:: https://github.com/mjcaley/aiospamc/actions/workflows/unit-tests.yml/badge.svg\n :target: https://github.com/mjcaley/aiospamc/actions/workflows/unit-tests.yml\n\n.. |integration| image:: https://github.com/mjcaley/aiospamc/actions/workflows/integration-tests.yml/badge.svg\n :target: https://github.com/mjcaley/aiospamc/actions/workflows/integration-tests.yml\n\n.. |docs| image:: https://readthedocs.org/projects/aiospamc/badge/?version=latest\n :target: https://aiospamc.readthedocs.io/en/latest/\n\n.. |license| image:: https://img.shields.io/github/license/mjcaley/aiospamc\n :target: ./LICENSE\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/aiospamc\n :target: https://python.org\n\n**aiospamc** is a client for SpamAssassin that you can use as a library or command line tool.\n\nThe implementation is based on asyncio; so you can use it in your applications for asynchronous calls.\n\nThe command line interface provides user-friendly access to SpamAssassin server commands and provides both JSON\nand user-consumable outputs.\n\n*************\nDocumentation\n*************\n\nDetailed documentation can be found at: https://aiospamc.readthedocs.io/\n\n************\nRequirements\n************\n\n* Python 3.9 or higher\n* `certifi` for updated certificate authorities\n* `loguru` for structured logging\n* `typer` for the command line interface\n\n********\nExamples\n********\n\nCommand-Line Tool\n=================\n\n`aiospamc` is your interface to SpamAssassin through CLI. To submit a message\nfor a score, use:\n\n.. code-block:: console\n\n # Take the output of gtube.msg and have SpamAssasin return a score\n $ cat ./gtube.msg | aiospamc check\n 1000.0/5.0\n\n # Ping the server\n $ aiospamc ping\n PONG\n\nLibrary\n=======\n\n.. code-block:: python\n\n import asyncio\n import aiospamc\n\n\n GTUBE = \"\"\"Subject: Test spam mail (GTUBE)\n Message-ID: <GTUBE1.1010101@example.net>\n Date: Wed, 23 Jul 2003 23:30:00 +0200\n From: Sender <sender@example.net>\n To: Recipient <recipient@example.net>\n Precedence: junk\n MIME-Version: 1.0\n Content-Type: text/plain; charset=us-ascii\n Content-Transfer-Encoding: 7bit\n\n This is the GTUBE, the\n Generic\n Test for\n Unsolicited\n Bulk\n Email\n\n If your spam filter supports it, the GTUBE provides a test by which you\n can verify that the filter is installed correctly and is detecting incoming\n spam. You can send yourself a test mail containing the following string of\n characters (in upper case and with no white spaces and line breaks):\n\n XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X\n\n You should send this test mail from an account outside of your network.\n \"\"\".encode(\"ascii\")\n\n\n # Ping the SpamAssassin server\n async def is_alive():\n pong = await aiospamc.ping()\n return True if pong.status_code == 0 else False\n\n asyncio.run(is_alive())\n # True\n\n\n # Get the spam score of a message\n async def get_score(message):\n response = await aiospamc.check(message)\n return response.headers.spam.score, response.headers.spam.threshold\n\n asyncio.run(get_score(GTUBE))\n # (1000.0, 5.0)\n\n\n # List the modified headers\n async def list_headers(message):\n response = await aiospamc.headers(message)\n for line in response.body.splitlines():\n print(line.decode())\n\n asyncio.run(list_headers(GTUBE))\n # Received: from localhost by DESKTOP.\n # with SpamAssassin (version 4.0.0);\n # Wed, 30 Aug 2023 20:11:34 -0400\n # From: Sender <sender@example.net>\n # To: Recipient <recipient@example.net>\n # Subject: Test spam mail (GTUBE)\n # Date: Wed, 23 Jul 2003 23:30:00 +0200\n # Message-Id: <GTUBE1.1010101@example.net>\n # X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on DESKTOP.\n # X-Spam-Flag: YES\n # X-Spam-Level: **************************************************\n # X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE,NO_RECEIVED,\n # NO_RELAYS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no\n # version=4.0.0\n # MIME-Version: 1.0\n # Content-Type: multipart/mixed; boundary=\"----------=_64EFDAB6.3640FAEF\"\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An asyncio-based library to communicate with SpamAssassin's SPAMD service.",
"version": "1.1.1",
"project_urls": {
"Documentation": "https://aiospamc.readthedocs.io",
"Homepage": "https://github.com/mjcaley/aiospamc",
"Repository": "https://github.com/mjcaley/aiospamc"
},
"split_keywords": [
"spam",
" spamc",
" spamassassin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7b2b09c8ca5efa6ff091f855ae5e7d6a8114ec85036943936503284896073b33",
"md5": "8563eb4c58a2906a9a509629b785b270",
"sha256": "a70c6b294cbd14d80095d69e8d9497f14456504f88ad3a05aa9cf1c9c59d84a0"
},
"downloads": -1,
"filename": "aiospamc-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8563eb4c58a2906a9a509629b785b270",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 27734,
"upload_time": "2024-10-09T16:15:20",
"upload_time_iso_8601": "2024-10-09T16:15:20.133193Z",
"url": "https://files.pythonhosted.org/packages/7b/2b/09c8ca5efa6ff091f855ae5e7d6a8114ec85036943936503284896073b33/aiospamc-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8af74ae0daa1e59823232aeb88cc48f0c2d61779b04270af0630c78c2c6dd11b",
"md5": "9286c768d7a00330436acd80ee482485",
"sha256": "14856f154c8c96e25b09bb291b6a15c65578aa59bfd2d2da8c8b26a3d76e409c"
},
"downloads": -1,
"filename": "aiospamc-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "9286c768d7a00330436acd80ee482485",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 24771,
"upload_time": "2024-10-09T16:15:21",
"upload_time_iso_8601": "2024-10-09T16:15:21.094153Z",
"url": "https://files.pythonhosted.org/packages/8a/f7/4ae0daa1e59823232aeb88cc48f0c2d61779b04270af0630c78c2c6dd11b/aiospamc-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-09 16:15:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mjcaley",
"github_project": "aiospamc",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiospamc"
}