{
"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 :: Software Development :: Libraries :: Python Modules"
],
"description": "About\n-----\n\ntrio_swagger11 is a trio-compatible clone of swagger.py, capable of\nunderstanding Swagger 1.1 definitions (only).\n\nAs swagger has been renamed to OpenAPI which by now has version 3.0\n(and has an actual specification \u2013 unlike Swagger 1.1) this library is\n(mostly) only usable with Asterisk, which still uses Swagger 1.1\ndeclarations.\n\nTrio-swagger11 supports a WebSocket extension, allowing a WebSocket to\nbe documented, and auto-generated WebSocket client code.\n\nfrom swagger.py:\n================\n\nSwagger.py is a Python library for using\n`Swagger `__ defined APIs.\n\nSwagger itself is best described on the Swagger home page:\n\n Swagger is a specification and complete framework implementation for\n describing, producing, consuming, and visualizing RESTful web\n services.\n\nThe `Swagger\nspecification `__ defines\nhow APIs may be described using Swagger.\n\nUsage\n-----\n\nInstall the latest release from PyPI.\n\n::\n\n $ sudo pip install trio_swagger11\n\nOr install from source using the ``setup.py`` script.\n\n::\n\n $ sudo ./setup.py install\n\nAPI\n===\n\ntrio_swagger11 will dynamically build an object model from a Swagger-enabled\nRESTful API.\n\nHere is a simple example using the `Asterisk REST\nInterface `__\n\n.. code:: Python\n\n #!/usr/bin/env python3\n\n import json\n import trio\n\n from trio_swagger11.client import SwaggerClient\n from trio_swagger11.http_client import AsynchronousHttpClient\n\n http_client = AsynchronousHttpClient()\n http_client.set_api_key('localhost', 'hey:peekaboo')\n\n async def run(ari,msg_json):\n channelId = msg_json['channel']['id']\n await ari.channels.answer(channelId=channelId)\n await ari.channels.play(channelId=channelId,\n media='sound:hello-world')\n # In a real program you should wait for the PlaybackFinished event instead\n await trio.sleep(3)\n await ari.channels.continueInDialplan(channelId=channelId)\n\n async def main():\n ari = SwaggerClient(\n \"http://localhost:8088/ari/api-docs/resources.json\",\n http_client=http_client)\n\n ws = ari.events.eventWebsocket(app='hello')\n\n async for msg in ws:\n if not isinstance(msg, WebsocketDataMessage):\n break\n elif not isinstance(msg, WebsocketTextMessage):\n continue # ignore bytes\n\n msg_json = json.loads(msg.data)\n if msg_json['type'] == 'StasisStart':\n await nursery.start_soon(run,ari,msg_json)\n\n if __name__ == \"__main__\":\n trio.run(main)\n \n\nData model\n==========\n\nThe data model presented by the ``swagger_model`` module is nearly\nidentical to the original Swagger API resource listing and API\ndeclaration. This means that if you add extra custom metadata to your\ndocs (such as a ``_author`` or ``_copyright`` field), they will carry\nforward into the object model. I recommend prefixing custom fields with\nan underscore, to avoid collisions with future versions of Swagger.\n\nThere are a few meaningful differences.\n\n- Resource listing\n- The ``file`` and ``base_dir`` fields have been added, referencing the\n original ``.json`` file.\n- The objects in a ``resource_listing``'s ``api`` array contains a\n field ``api_declaration``, which is the processed result from the\n referenced API doc.\n- API declaration\n- A ``file`` field has been added, referencing the original ``.json``\n file.\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/swagger\n $ . ~/virtualenv/swagger/bin/activate\n\n`Setuptools `__ is used for\nbuilding. `Pytest `__ 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 pytest # run unit tests\n $ ./setup.py bdist_egg # build distributable\n\n\nTesting\n=======\n\nSimply run ``python3 setup.py pytest``.\n\nNote that standalone-testing this module currently is not possible.\nPrevious versions required a hacked version of httpretty.\n\nTODO: use a local server instead.\n\n\nLicense\n-------\n\nCopyright (c) 2013, Digium, Inc.\nCopyright (c) 2018, Matthias Urlichs\n\ntrio_swagger11 is licensed with a `BSD 3-Clause\nLicense `__.\n\nThe current author humbly requests that you share any further bug fixes or\nenhancements to this code.\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/trio_swagger11",
"keywords": "",
"license": "BSD 3-Clause License",
"maintainer": "",
"maintainer_email": "",
"name": "trio_swagger11",
"package_url": "https://pypi.org/project/trio_swagger11/",
"platform": "",
"project_url": "https://pypi.org/project/trio_swagger11/",
"project_urls": {
"Homepage": "https://github.com/M-o-a-T/trio_swagger11"
},
"release_url": "https://pypi.org/project/trio_swagger11/0.11.1/",
"requires_dist": null,
"requires_python": "",
"summary": "Asynchronous library for accessing Swagger-1.1-enabled APIs",
"version": "0.11.1"
},
"last_serial": 4967929,
"releases": {
"0.11.0": [
{
"comment_text": "",
"digests": {
"md5": "4259d1852891176f24e3fdf4f4592e3b",
"sha256": "8ecd6a8dc10b1fadc6c76711ceefaba47d99502cd8be89ab6470271a2e6c25b5"
},
"downloads": -1,
"filename": "trio_swagger11-0.11.0.tar.gz",
"has_sig": false,
"md5_digest": "4259d1852891176f24e3fdf4f4592e3b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26662,
"upload_time": "2019-03-18T10:24:04",
"url": "https://files.pythonhosted.org/packages/6a/66/07bc654e2d88d27b5ee91690e4ab8e6d15f24e0ec47976865c15f368bb62/trio_swagger11-0.11.0.tar.gz"
}
],
"0.11.1": [
{
"comment_text": "",
"digests": {
"md5": "54b28d7db47f54974ced4c65dd6ddd37",
"sha256": "663b5792e408d38cf754bc6e277c9699afce9e62e88e77491a8bf92387e9cb9b"
},
"downloads": -1,
"filename": "trio_swagger11-0.11.1.tar.gz",
"has_sig": false,
"md5_digest": "54b28d7db47f54974ced4c65dd6ddd37",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26889,
"upload_time": "2019-03-21T12:35:52",
"url": "https://files.pythonhosted.org/packages/ff/56/3ea68d157e852d01dd8e74bab651e7bafb1313f0fc6be52d5bfe72b26a25/trio_swagger11-0.11.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "54b28d7db47f54974ced4c65dd6ddd37",
"sha256": "663b5792e408d38cf754bc6e277c9699afce9e62e88e77491a8bf92387e9cb9b"
},
"downloads": -1,
"filename": "trio_swagger11-0.11.1.tar.gz",
"has_sig": false,
"md5_digest": "54b28d7db47f54974ced4c65dd6ddd37",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26889,
"upload_time": "2019-03-21T12:35:52",
"url": "https://files.pythonhosted.org/packages/ff/56/3ea68d157e852d01dd8e74bab651e7bafb1313f0fc6be52d5bfe72b26a25/trio_swagger11-0.11.1.tar.gz"
}
]
}