Skip to main content

Wrapper for SpamAssassin SPAMC deamon

Project description

# SpamAssassin Client python module
This is a python wrapper for SpamAssissin's SPAMC deamon. It provides these funtions:
* get_score(float) - final score from spamassasin
* get_fulltext(string) - full report as string from SpamAssasin deamon
* get_report_json(json) - full report as JSON from SpamAssasin deamon


# Instalation

Install SpamAssassin

sudo apt get spamassassin

Pytest needs to be installed to run tests

sudo apt install python-pytest

Use PIP package manager to install this module

pip install spamassassin_client



# Example

Module can be used in following way:

import os

from spamassassin_client import SpamAssassin

FILES = [dict(type='spam', name='sample-spam.txt'),
dict(type='ham', name='sample-nonspam.txt')]

def main():

path = os.path.dirname(__file__)
for test in FILES:
filename = os.path.join(path, test['name'])
with open(filename,"rb") as f:
print("\nProcessing file: {}".format(filename))
assassin = SpamAssassin(f.read())
print(assassin)
if assassin.is_spam():
print("The received message is considered spam with a score of {0}".format(assassin.get_score()))
print('\nreport_fulltext:', assassin.get_fulltext())
print('score:', assassin.get_score())
print('report_json:', assassin.get_report_json())

if __name__ == "__main__":
main()


# Run tests

pytest -v



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spamassassin_client-0.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spamassassin_client-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file spamassassin_client-0.0.1.tar.gz.

File metadata

  • Download URL: spamassassin_client-0.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15rc1

File hashes

Hashes for spamassassin_client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f4219d7f52656f7dbae2dab81a32b624aba8f4a4c677668e34e67c66d632f71e
MD5 5bfaa66ce82b21d29f73dc15966f707a
BLAKE2b-256 4c106c8b571f44f5f68d4b63c787e82fe8e366ea957adbba016cce54c2adaf14

See more details on using hashes here.

File details

Details for the file spamassassin_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: spamassassin_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15rc1

File hashes

Hashes for spamassassin_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7be645a2f54f114b1589bdfc64629314dcb208120b937784e9be4b5eee17a31f
MD5 5798fa3a95dd9778be7436015951a6d3
BLAKE2b-256 8f4a07eca6e1c453392602027d65a17dc77f71c4ac0678bb596ead307695a3ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page