An asyncio-based library to communicate with SpamAssassin's SPAMD service.
Project description
Description
Python asyncio-based library that implements the SPAMC/SPAMD client protocol used by SpamAssassin.
Documentation
Documentation can be found at: https://aiospamc.readthedocs.io/
Requirements
Python 3.8 or higher
As a Command Line Tool
aiospamc is your interface to SpamAssassin through CLI. To submit a message for a score, use:
cat ./gtube.msg | aiospamc check
and the response will be the score of the message:
1000.0/5.0
Sub-commands for learning and reporting are also supported.
As a Library
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')
loop = asyncio.get_event_loop()
responses = loop.run_until_complete(asyncio.gather(
aiospamc.ping(host='localhost'),
aiospamc.check(GTUBE, host='localhost'),
aiospamc.headers(GTUBE, host='localhost')
))
print(responses)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiospamc-0.10.0.tar.gz
(21.1 kB
view hashes)
Built Distribution
aiospamc-0.10.0-py3-none-any.whl
(24.6 kB
view hashes)
Close
Hashes for aiospamc-0.10.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53381adc53814647608ec864263eb975cf9bf04370f16adc2e1c1fa7aca2f538 |
|
MD5 | 88af54ea64430bf056526a867433af67 |
|
BLAKE2b-256 | a8026ace2edc9b23ed8d0a14ff39cf2506b548d243c26005462830ad5e7ba9ef |