{"id":13814000,"url":"https://github.com/digium/swagger-py","last_synced_at":"2025-12-14T15:37:07.671Z","repository":{"id":55492644,"uuid":"13657411","full_name":"digium/swagger-py","owner":"digium","description":"Swagger client library for Python","archived":false,"fork":false,"pushed_at":"2020-12-27T11:54:51.000Z","size":102,"stargazers_count":82,"open_issues_count":13,"forks_count":50,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-12T07:39:29.612Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digium.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-17T18:29:13.000Z","updated_at":"2024-07-31T16:55:26.000Z","dependencies_parsed_at":"2022-08-15T01:40:38.784Z","dependency_job_id":null,"html_url":"https://github.com/digium/swagger-py","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digium%2Fswagger-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digium%2Fswagger-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digium%2Fswagger-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digium%2Fswagger-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digium","download_url":"https://codeload.github.com/digium/swagger-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254256289,"owners_count":22040266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T04:01:39.499Z","updated_at":"2025-12-14T15:37:07.639Z","avatar_url":"https://github.com/digium.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"About\n-----\n\nSwagger.py is a Python library for using\n`Swagger \u003chttps://developers.helloreverb.com/swagger/\u003e`__ defined API's.\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 \u003chttps://github.com/wordnik/swagger-core/wiki\u003e`__ defines\nhow API's may be described using Swagger.\n\nSwagger.py also supports a WebSocket extension, allowing a WebSocket to\nbe documented, and auto-generated WebSocket client code.\n\nUsage\n-----\n\nInstall the latest release from PyPI.\n\n::\n\n    $ sudo pip install swaggerpy\n\nOr install from source using the ``setup.py`` script.\n\n::\n\n    $ sudo ./setup.py install\n\nAPI\n===\n\nSwagger.py will dynamically build an object model from a Swagger-enabled\nRESTful API.\n\nHere is a simple example using the `Asterisk REST\nInterface \u003chttps://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ARI\u003e`__\n\n.. code:: Python\n\n    #!/usr/bin/env python\n\n    import json\n\n    from swaggerpy.client import SwaggerClient\n    from swaggerpy.http_client import SynchronousHttpClient\n\n    http_client = SynchronousHttpClient()\n    http_client.set_basic_auth('localhost', 'hey', 'peekaboo')\n\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    for msg_str in iter(lambda: ws.recv(), None):\n        msg_json = json.loads(msg_str)\n        if msg_json['type'] == 'StasisStart':\n            channelId = msg_json['channel']['id']\n            ari.channels.answer(channelId=channelId)\n            ari.channels.play(channelId=channelId,\n                              media='sound:hello-world')\n            ari.channels.continueInDialplan(channelId=channelId)\n\nswagger-codegen\n===============\n\nThere are the beginnings of a Mustache-based code generator, but it's\nnot functional... yet.\n\n.. Inspired by the original [swagger-codegen][] project, templates are\n   written using [Mustache][] templates ([Pystache][], specifically).\n   There are several important differences.\n\n    * The model that is fed into the mustache templates is almost\n      identical to Swagger's API resource listing and API declaration\n      model. The differences are listed [below](#model).\n    * The templates themselves are completely self contained, with the\n      logic to enrich the model being specified in `translate.py` in the\n      same directory as the `*.mustache` files.\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 \u003chttp://sphinx-doc.org/\u003e`__, which\nallows `IntelliJ IDEA \u003chttp://confluence.jetbrains.net/display/PYH/\u003e`__\nto do a better job at inferring types for autocompletion.\n\nTo keep things isolated, I also recommend installing (and using)\n`virtualenv \u003chttp://www.virtualenv.org/\u003e`__.\n\n::\n\n    $ sudo pip install virtualenv\n    $ mkdir -p ~/virtualenv\n    $ virtualenv ~/virtualenv/swagger\n    $ . ~/virtualenv/swagger/bin/activate\n\n`Setuptools \u003chttp://pypi.python.org/pypi/setuptools\u003e`__ is used for\nbuilding. `Nose \u003chttp://nose.readthedocs.org/en/latest/\u003e`__ is used\nfor unit testing, with the `coverage\n\u003chttp://nedbatchelder.com/code/coverage/\u003e`__ 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\n\n\nLicense\n-------\n\nCopyright (c) 2013, Digium, Inc. All rights reserved.\n\nSwagger.py is licensed with a `BSD 3-Clause\nLicense \u003chttp://opensource.org/licenses/BSD-3-Clause\u003e`__.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigium%2Fswagger-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigium%2Fswagger-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigium%2Fswagger-py/lists"}