aiospamc


Nameaiospamc JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/mjcaley/aiospamc
SummaryAn asyncio-based library to communicate with SpamAssassin's SPAMD service.
upload_time2017-05-18 15:11:58
maintainer
docs_urlhttp://pythonhosted.org/aiospamc/
authorMichael Caley
requires_python
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.

-------------
Documentation
-------------

Documentation can be found at: https://pythonhosted.org/aiospamc/

------------
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": "", 
    "docs_url": "http://pythonhosted.org/aiospamc/", 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "coveralis": false, 
    "keywords": "spam spamc spamassassin", 
    "upload_time": "2017-05-18 15:11:58", 
    "author": "Michael Caley", 
    "home_page": "https://github.com/mjcaley/aiospamc", 
    "github_user": "mjcaley", 
    "download_url": "https://pypi.python.org/packages/02/ef/b460357b0717dd7fc7b4a72318b586fd962b88894af3632e7b256a247c6e/aiospamc-0.2.1.tar.gz", 
    "platform": "UNKNOWN", 
    "version": "0.2.1", 
    "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-----------\n\nPython asyncio-based library that implements the SPAMC/SPAMD client protocol used by SpamAssassin.\n\n-------------\nDocumentation\n-------------\n\nDocumentation can be found at: https://pythonhosted.org/aiospamc/\n\n------------\nRequirements\n------------\n\n* Python 3.5 or higher\n\n-------\nExample\n-------\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-05-18T15:11:56", 
            "comment_text": "", 
            "python_version": "py3", 
            "url": "https://pypi.python.org/packages/d9/d4/7a85e4fdc2e89f6be9cb2c712c24be260b040e5232894b6d57976c15492a/aiospamc-0.2.1-py3-none-any.whl", 
            "md5_digest": "cea5ba808e1d0a1c1a0b24d0e49adb17", 
            "downloads": 0, 
            "filename": "aiospamc-0.2.1-py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "d9/d4/7a85e4fdc2e89f6be9cb2c712c24be260b040e5232894b6d57976c15492a/aiospamc-0.2.1-py3-none-any.whl", 
            "size": 18899
        }, 
        {
            "has_sig": false, 
            "upload_time": "2017-05-18T15:11:58", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/02/ef/b460357b0717dd7fc7b4a72318b586fd962b88894af3632e7b256a247c6e/aiospamc-0.2.1.tar.gz", 
            "md5_digest": "858608910457b56c301fa3dd8742a520", 
            "downloads": 0, 
            "filename": "aiospamc-0.2.1.tar.gz", 
            "packagetype": "sdist", 
            "path": "02/ef/b460357b0717dd7fc7b4a72318b586fd962b88894af3632e7b256a247c6e/aiospamc-0.2.1.tar.gz", 
            "size": 12014
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}