aiospamc


Nameaiospamc JSON
Version 0.1.0 PyPI version JSON
home_pagehttps://github.com/mjcaley/aiospamc
SummaryAn asyncio-based library to communicate with SpamAssassin's SPAMD service.
upload_time2017-01-11 20:41:14
maintainerNone
docs_urlNone
authorMichael Caley
requires_pythonNone
licenseMIT
keywords spam spamc spamassassin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
Coveralis test coverage No Coveralis.
            ========
aiospamc
========

.. image:: https://travis-ci.org/mjcaley/aiospamc.svg?branch=master
    :target: https://travis-ci.org/mjcaley/aiospamc
.. image:: https://codecov.io/gh/mjcaley/aiospamc/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/mjcaley/aiospamc

-----------
Description
-----------
Python asyncio-based library that implements the SPAMC/SPAMD client protocol used by SpamAssassin.

------------
Requirements
------------
* Python 3.5 or higher

-------
Example
-------
.. code:: python

    import asyncio
    import logging

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

    def example():
        import email
        gtube_msg = email.message_from_string(GTUBE)

        async def print_response(title, func, *opts):
            try:
                resp = await func(*opts)
                print('----------------------------------------------------------')
                print(title, ':', repr(resp))
            except Exception as e:
                logging.exception(' '.join(['Error:', str(e)]))

        loop = asyncio.new_event_loop()
        client = aiospamc.Client(loop=loop)

        loop.run_until_complete(
            asyncio.gather(
                print_response('Ping', client.ping),
                print_response('Check', client.check, str(gtube_msg)),
                print_response('Headers', client.headers, str(gtube_msg)),
                loop=loop)
        )

        loop.close()

    if __name__ == '__main__':
        example()
            

Raw data

            {
    "maintainer": null, 
    "docs_url": null, 
    "requires_python": null, 
    "maintainer_email": null, 
    "cheesecake_code_kwalitee_id": null, 
    "coveralis": false, 
    "keywords": "spam spamc spamassassin", 
    "upload_time": "2017-01-11 20:41:14", 
    "author": "Michael Caley", 
    "home_page": "https://github.com/mjcaley/aiospamc", 
    "github_user": "mjcaley", 
    "download_url": "https://pypi.python.org/packages/b3/da/54d38473a3646287acf918e21c6ccf2cd68d6802d4ef5d0d27a6029e67d1/aiospamc-0.1.0.tar.gz", 
    "platform": "UNKNOWN", 
    "version": "0.1.0", 
    "cheesecake_documentation_id": null, 
    "description": "========\naiospamc\n========\n\n.. image:: https://travis-ci.org/mjcaley/aiospamc.svg?branch=master\n    :target: https://travis-ci.org/mjcaley/aiospamc\n.. image:: https://codecov.io/gh/mjcaley/aiospamc/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/mjcaley/aiospamc\n\n-----------\nDescription\n-----------\nPython asyncio-based library that implements the SPAMC/SPAMD client protocol used by SpamAssassin.\n\n------------\nRequirements\n------------\n* Python 3.5 or higher\n\n-------\nExample\n-------\n.. code:: python\n\n    import asyncio\n    import logging\n\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    '''\n\n    def example():\n        import email\n        gtube_msg = email.message_from_string(GTUBE)\n\n        async def print_response(title, func, *opts):\n            try:\n                resp = await func(*opts)\n                print('----------------------------------------------------------')\n                print(title, ':', repr(resp))\n            except Exception as e:\n                logging.exception(' '.join(['Error:', str(e)]))\n\n        loop = asyncio.new_event_loop()\n        client = aiospamc.Client(loop=loop)\n\n        loop.run_until_complete(\n            asyncio.gather(\n                print_response('Ping', client.ping),\n                print_response('Check', client.check, str(gtube_msg)),\n                print_response('Headers', client.headers, str(gtube_msg)),\n                loop=loop)\n        )\n\n        loop.close()\n\n    if __name__ == '__main__':\n        example()", 
    "lcname": "aiospamc", 
    "bugtrack_url": null, 
    "github": true, 
    "name": "aiospamc", 
    "license": "MIT", 
    "travis_ci": true, 
    "github_project": "aiospamc", 
    "summary": "An asyncio-based library to communicate with SpamAssassin's SPAMD service.", 
    "split_keywords": [
        "spam", 
        "spamc", 
        "spamassassin"
    ], 
    "author_email": "mjcaley@darkarctic.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-01-11T20:41:12", 
            "comment_text": "", 
            "python_version": "py3", 
            "url": "https://pypi.python.org/packages/d3/6e/d4b7063ece98861e7da512e1b8c0404211232f26da6fa7e570b3cb87693a/aiospamc-0.1.0-py3-none-any.whl", 
            "md5_digest": "3be7329e8a9c007dff605e12e836615f", 
            "downloads": 0, 
            "filename": "aiospamc-0.1.0-py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "d3/6e/d4b7063ece98861e7da512e1b8c0404211232f26da6fa7e570b3cb87693a/aiospamc-0.1.0-py3-none-any.whl", 
            "size": 15356
        }, 
        {
            "has_sig": false, 
            "upload_time": "2017-01-11T20:41:14", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/b3/da/54d38473a3646287acf918e21c6ccf2cd68d6802d4ef5d0d27a6029e67d1/aiospamc-0.1.0.tar.gz", 
            "md5_digest": "576e8acdceb9492bf748c028ef5052b9", 
            "downloads": 0, 
            "filename": "aiospamc-0.1.0.tar.gz", 
            "packagetype": "sdist", 
            "path": "b3/da/54d38473a3646287acf918e21c6ccf2cd68d6802d4ef5d0d27a6029e67d1/aiospamc-0.1.0.tar.gz", 
            "size": 10454
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}