Package: codet-swaggerpy
**ORIGINAL REPO:** [digium/swagger-py](https://github.com/digium/swagger-py.git)About-----Swagger.py is a Python library for using`Swagger ` [codet-swaggerpy](https://github.com/Thulebona/codet-swaggerpy.git) __ defined API's.Swagger itself is best described on the Swagger home page:Swagger is a specification and complete framework implementation fordescribing, producing, consuming, and visualizing RESTful webservices.The `Swaggerspecification <https://github.com/wordnik/swagger-core/wiki>`__ defineshow API's may be described using Swagger.Swagger.py also supports a WebSocket extension, allowing a WebSocket tobe documented, and auto-generated WebSocket client code.python -v---------Python3Usage-----Install the latest release from PyPI.::$ sudo pip install codet-swaggerpyOr install from source using the ``setup.py`` script.::$ pip install -e  ./API===Swagger.py will dynamically build an object model from a Swagger-enabledRESTful API.Here is a simple example using the `Asterisk RESTInterface <https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ARI>`__.. code:: Python#!/usr/bin/env pythonimport jsonfrom swaggerpy.client import SwaggerClientfrom swaggerpy.http_client import SynchronousHttpClienthttp_client = SynchronousHttpClient()http_client.set_basic_auth('localhost', 'hey', 'peekaboo')ari = SwaggerClient("http://localhost:8088/ari/api-docs/resources.json",http_client=http_client)ws = ari.events.eventWebsocket(app='hello')for msg_str in iter(lambda: ws.recv(), None):msg_json = json.loads(msg_str)if msg_json['type'] == 'StasisStart':channelId = msg_json['channel']['id']ari.channels.answer(channelId=channelId)ari.channels.play(channelId=channelId,media='sound:hello-world')ari.channels.continueInDialplan(channelId=channelId)swagger-codegen===============There are the beginnings of a Mustache-based code generator, but it'snot functional... yet... Inspired by the original [swagger-codegen][] project, templates arewritten using [Mustache][] templates ([Pystache][], specifically).There are several important differences.* The model that is fed into the mustache templates is almostidentical to Swagger's API resource listing and API declarationmodel. The differences are listed [below](#model).* The templates themselves are completely self contained, with thelogic to enrich the model being specified in `translate.py` in thesame directory as the `*.mustache` files.Data model==========The data model presented by the ``swagger_model`` module is nearlyidentical to the original Swagger API resource listing and APIdeclaration. This means that if you add extra custom metadata to yourdocs (such as a ``_author`` or ``_copyright`` field), they will carryforward into the object model. I recommend prefixing custom fields withan underscore, to avoid collisions with future versions of Swagger.There are a few meaningful differences.-  Resource listing-  The ``file`` and ``base_dir`` fields have been added, referencing theoriginal ``.json`` file.-  The objects in a ``resource_listing``'s ``api`` array contains afield ``api_declaration``, which is the processed result from thereferenced API doc.-  API declaration-  A ``file`` field has been added, referencing the original ``.json``file.Development-----------The code is documented using `Sphinx <http://sphinx-doc.org/>`__, whichallows `IntelliJ IDEA <http://confluence.jetbrains.net/display/PYH/>`__to do a better job at inferring types for autocompletion.To keep things isolated, I also recommend installing (and using)`virtualenv <http://www.virtualenv.org/>`__.::$ sudo pip install virtualenv$ mkdir -p ~/virtualenv$ virtualenv ~/virtualenv/swagger$ . ~/virtualenv/swagger/bin/activate`Setuptools <http://pypi.python.org/pypi/setuptools>`__ is used forbuilding. `Nose <http://nose.readthedocs.org/en/latest/>`__ is usedfor unit testing, with the `coverage<http://nedbatchelder.com/code/coverage/>`__ plugin installed togenerated code coverage reports. Pass ``--with-coverage`` to generatethe code coverage report. HTML versions of the reports are put in``cover/index.html``.::$ ./setup.py develop   # prep for development (install deps, launchers, etc.)$ ./setup.py test # run unit tests$ ./setup.py bdist_egg # build distributableLicense-------Copyright (c) 2013, Digium, Inc. All rights reserved.Swagger.py is licensed with a `BSD 3-ClauseLicense <http://opensource.org/licenses/BSD-3-Clause>`__.