Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Add API to introspect routes for your Pyramid web app

Project description

tomb_reflect

https://img.shields.io/pypi/v/tomb_reflect.svg https://img.shields.io/travis/tomborine/tomb_reflect.svg https://coveralls.io/repos/tomborine/tomb_reflect/badge.png?branch=master

Intro

Easily make your Pyramid-powered Web API introspectable.

All it takes is:

config.include('tomb_reflect', route_prefix='/api_info')

 # You could pass options to tomb_reflect_add_views to add auth, etc.
 config.tomb_reflect_add_views()

With this, your app now responds to 2 new URLs.

The first URL, /api_info/routes, returns a list of routes:

{
    "hello": {
        "route_pattern": "/hello"
    },
    "hello_name": {
        "route_pattern": "/hello_name/{name}"
    },
    "tomb_reflect.routes#index": {
        "route_pattern": "api_info/routes"
    },
    "tomb_reflect.routes#show": {
        "route_pattern": "api_info/routes/{route_name}"
    }
}

The second URL, /api_info/routes/{route_name}, returns detailed info for a specific route:

{
    "route_name": "hello",
    "route_pattern": "/hello",
    "view": "inventorysvc.views.hello.hello"
}

Configuration

If you want the URLs to be under a different root path, change the route_prefix in your config.include call:

config.include('tomb_reflect', route_prefix='/super/secret/place')

If you want the URLs to only be visible with certain permissions, require special authorization, etc., you can pass options to config.tomb_reflect_add_views:

# You can pass options to tomb_reflect_add_views to add auth, etc.
config.tomb_reflect_add_views(
    decorator=SomeCustomDecorator,
    permission='reflect')

Similar

Project details


Download files

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

Files for tomb_reflect, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size tomb_reflect-0.0.1.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page