Skip to main content

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": {}
    }
  }
}

Metadata

Release files for pecan-swagger 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pecan-swagger 0.1.2
File Interpreter ABI Platform Actions
pecan_swagger-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for pecan_swagger-0.1.2-py2.py3-none-any.whl

Release files / pecan_swagger-0.1.2-py2.py3-none-any.whl

Download URL pecan_swagger-0.1.2-py2.py3-none-any.whl
Size 6.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
dc838731b06c862a217334f7acf7f185f92c7a4d65ef633115d70832374ca212
BLAKE2b-256 checksum
How to use checksums
940694b7dd4a96e98e02a49481209f73b5aac6b3ea6d1c205ad739ce91ec18d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pecan-swagger 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file No provenance

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page