{ "info": { "author": "Matthias Urlichs", "author_email": "matthias@urlichs.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Communications :: Telephony", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Asynchronous clone of https://github.com/asterisk/ari-py\n\nUses async version of swagger-py\n\n\n\n\nAbout\n-----\n\nThis package contains the Python client library for the Asterisk REST\nInterface. It builds upon the\n`Swagger.py `__ library, providing an\nimproved, Asterisk-specific API over the API generated by Swagger.py\n\nUsage\n-----\n\nInstall from source using the ``setup.py`` script.\n\n::\n\n $ sudo ./setup.py install\n\n\nAPI\n===\n\nAn async ARI client can be created simply by the ``aioari.connect`` method.\nThis will create a client based on the Swagger API downloaded from Asterisk.\n\nThe API is modeled into the Repository Pattern, as you would find in Domain\nDriven Design. Each Swagger Resource (a.k.a. API declaration) is mapped into a\nRepository object, which is provided as a field on the client\n(``client.channels``, ``client.bridges``).\n\nResponses from Asterisk are mapped into first-class objects, akin to Domain\nObjects in the Repository Pattern. These are provided both on the responses\nto RESTful API calls, and for fields from events received over the WebSocket.\n\nMaking REST calls\n=================\n\nEach Repository Object provides methods which invoke the non-instance specific\noperations of the associated Swagger resource (``bridges.list()``,\n``channels.get()``). Instance specific methods are also provided, which require\nidentity parameters to be passed along (``channels.get(channelId=id)``).\n\nInstance specific methods are also provided on the Domain Objects\n(``some_channel.hangup()``).\n\nRegistering event callbacks\n===========================\n\nAsterisk may send asyncronous messages over a WebSocket to indicate events of\ninterest to the application.\n\nThe ``Client`` object has an ``on_event`` method, which can be used to\nsubscribe for specific events from Asterisk.\n\nThe first-class objects also have 'on_event' methods, which can subscribe to\nStasis events relating to that object.\n\nObject lifetime\n===============\n\nThe Repository Objects exist for the lifetime of the client that owns them.\n\nDomain Objects are ephemeral, and not tied to the lifetime of the underlying\nobject in Asterisk. Pratically, this means that if you call\n``channels.get('1234')`` several times, you may get a different object back\nevery time.\n\nYou may hold onto an instance of a Domain Object, but you should consider it\nto be stale. The data contained in the object may be out of date, but the\nmethods on the object should still behave properly.\n\nIf you invoke a method on a stale Domain Object that no longer exists in\nAsterisk, you will get a HTTPError exception (404 Not Found).\n\nCaveats\n=======\n\nThe dynamic methods exposed by Repository and Domain objects are, effectively,\nremote procedure calls. The current implementation is synchronous, which means\nthat if anything were to happen to slow responses (slow network, packet loss,\nsystem load, etc.), then the entire application could be affected.\n\nExamples\n========\n\n.. code:: Python\n\n import asyncio\n import aioari\n\n client = await aioari.connect('http://localhost:8088/', 'hey', 'peekaboo')\n\n def on_dtmf(channel, event):\n digit = event['digit']\n if digit == '#':\n channel.play(media='sound:goodbye')\n channel.continueInDialplan()\n elif digit == '*':\n channel.play(media='sound:asterisk-friend')\n else:\n channel.play(media='sound:digits/%s' % digit)\n\n\n def on_start(channel, event):\n channel.on_event('ChannelDtmfReceived', on_dtmf)\n channel.answer()\n channel.play(media='sound:hello-world')\n\n\n client.on_channel_event('StasisStart', on_start)\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(client.run(apps=\"hello\"))\n\n\n\nDevelopment\n-----------\n\nThe code is documented using `Sphinx `__, which\nallows `IntelliJ IDEA `__\nto do a better job at inferring types for autocompletion.\n\nTo keep things isolated, I also recommend installing (and using)\n`virtualenv `__.\n\n::\n\n $ sudo pip install virtualenv\n $ mkdir -p ~/virtualenv\n $ virtualenv ~/virtualenv/ari\n $ . ~/virtualenv/ari/bin/activate\n\n`Setuptools `__ is used for\nbuilding. `Nose `__ is used\nfor unit testing, with the `coverage\n`__ plugin installed to\ngenerated code coverage reports. Pass ``--with-coverage`` to generate\nthe code coverage report. HTML versions of the reports are put in\n``cover/index.html``.\n\n::\n\n $ ./setup.py develop # prep for development (install deps, launchers, etc.)\n $ ./setup.py nosetests # run unit tests\n $ ./setup.py bdist_egg # build distributable\n\nTODO\n====\n\n * Create asynchronous bindings that can be used with Twisted, Tornado, etc.\n * Add support for Python 3\n\nLicense\n-------\n\nCopyright (c) 2013-2014, Digium, Inc.\nCopyright (c) 2016, Denis Fokin.\nCopyright (c) 2018, Matthias Urlichs.\n\n.. \n The original text stated \"All rights reserved\" which does not make sense\n given a LICENSE.txt file with a BSD-3 license. Thus I removed it.\n -- Matthias Urlichs\n\naioari is licensed with a `BSD 3-Clause\nLicense `__.\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/M-o-a-T/aioari", "keywords": "", "license": "BSD 3-Clause License", "maintainer": "", "maintainer_email": "", "name": "aioari", "package_url": "https://pypi.org/project/aioari/", "platform": "", "project_url": "https://pypi.org/project/aioari/", "project_urls": { "Homepage": "https://github.com/M-o-a-T/aioari" }, "release_url": "https://pypi.org/project/aioari/0.10.0/", "requires_dist": null, "requires_python": "", "summary": "Asynchronous library for accessing the Asterisk REST Interface", "version": "0.10.0" }, "last_serial": 3696777, "releases": { "0.10.0": [ { "comment_text": "", "digests": { "md5": "51480358e335a490d9a025b09b661ca2", "sha256": "4c54a98e599c2884b477fda30ef331cee1055308185b320f3ff68d4f201dda68" }, "downloads": -1, "filename": "aioari-0.10.0.tar.gz", "has_sig": false, "md5_digest": "51480358e335a490d9a025b09b661ca2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12686, "upload_time": "2018-03-22T20:45:34", "url": "https://files.pythonhosted.org/packages/9a/13/e6f6b43b7e64f3dd8e41aeb7d520883c76f2b94ba2682a3ff53d183ac9e5/aioari-0.10.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "799283729dbeaeec9a275c0284752184", "sha256": "f046d80e2ed81c0f3307e2a1a999b99d7e442b0492ddbf55fccac5acb673f9e4" }, "downloads": -1, "filename": "aioari-0.9.1.tar.gz", "has_sig": false, "md5_digest": "799283729dbeaeec9a275c0284752184", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12513, "upload_time": "2018-01-17T13:38:54", "url": "https://files.pythonhosted.org/packages/e5/92/113d96d067797bb29a2703536b42d6d4aa5844b5fe4550954298879393b8/aioari-0.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "51480358e335a490d9a025b09b661ca2", "sha256": "4c54a98e599c2884b477fda30ef331cee1055308185b320f3ff68d4f201dda68" }, "downloads": -1, "filename": "aioari-0.10.0.tar.gz", "has_sig": false, "md5_digest": "51480358e335a490d9a025b09b661ca2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12686, "upload_time": "2018-03-22T20:45:34", "url": "https://files.pythonhosted.org/packages/9a/13/e6f6b43b7e64f3dd8e41aeb7d520883c76f2b94ba2682a3ff53d183ac9e5/aioari-0.10.0.tar.gz" } ] }