This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A project to produce swagger from pecan

Project Description

some helpers to create swagger output from a pecan app

example usage

given a file named myapp.py

import pecan
from pecan_swagger import decorators as swagger


@swagger.path('profile', 'Profile', 'Root')
class ProfileController(object):

    @pecan.expose(generic=True, template='index.html')
    def index(self):
        return dict()

    @index.when(method='POST')
    def index_post(self, **kw):
        print(kw)
        pecan.redirect('/profile')


@swagger.path('/', 'Root')
class RootController(object):

    profile = ProfileController()

and another file named myapp-doc.py

import pprint

from pecan_swagger import utils
import myapp

pp = pprint.PrettyPrinter(indent=2)
pp.pprint(utils.swagger_build('myapp', '1.0'))

the following will be produced when run

$ python myapp-doc.py
{
  "swagger": "2.0",
  "info": {
    "version": "1.0",
    "title": "myapp"
  },
  "paths": {
    "/profile": {
      "POST": {},
      "GET": {}
    }
  }
}
Release History

Release History

This version
History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pecan_swagger-0.1.2-py2.py3-none-any.whl (6.7 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Jun 2, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting