Overview

WSMorph

Web Services Morph is a small wsgi middleware that transforms webservices calls.

It understands several protocols and can translate function names, transform the input / output data structures with generic rules, rectify arguments...

The first goal of WSMorph is to build compatibility layers for webservices implemented with WSME or tgwebservices but it is independant of them and should work with any rest implementation.

Example:

import wsmorph

morph = wsmorph.WSMorph('/api/v1', '/api/v2')  # redirect all request made
                                               # on /api/v1 to /api/v2
morph.add_rename_function(
    # All functions under /api/v1/utilfunctions :
    'utilfunctions/(?P<name>.*)',

    # are renamed to /api/v2/utils/NAME
    'utils/%(name)s'
)

myapp = ...  # Create your wsgi application
application = morph.wsgi_middleware(myapp)