Exemple #1
0
                schema.get("version", "v1"),
                schema.get("protocol", "rest")
            ]),
            "icons":
            schema.get("icons"),
            "documentationLink":
            schema.get("documentationLink"),
            "labels":
            schema.get("labels"),
            "preferred":
            schema.get("preferred", True)
        })
        return dir


with map.submapper(path_prefix='/discovery/v1') as disco:
    disco.connect('discovery',
                  '/apis/{api}/{version}/{kind}',
                  controller=Apis,
                  action='getRest')
    disco.connect('discovery', '/apis', controller=Apis, action='list')

if __name__ == '__main__':  # pragma: no cover

    @api_entry(
        name="contacts",
        body={
            'type': "json",
            'doc': "A json object"
        },
        httpMethod="GET",
Exemple #2
0
            "name":schema.get("name"),
            "version": schema.get("version"),
            "title": schema.get("title"),
            "description": schema.get("description"),
            "discoveryLink": '/'.join(['.','apis',
                                      schema.get("name"),
                                      schema.get("version", "v1"),
                                      schema.get("protocol", "rest")]),
            "icons": schema.get("icons"),
            "documentationLink": schema.get("documentationLink"),
            "labels": schema.get("labels"),
            "preferred": schema.get("preferred", True)
        })
        return dir

with map.submapper(path_prefix='/discovery/v1') as disco:
    disco.connect('discovery', '/apis/{api}/{version}/{kind}', controller=Apis, action='getRest')
    disco.connect('discovery', '/apis', controller=Apis, action='list')


if __name__ == '__main__':  # pragma: no cover

    @api_entry(
        name="contacts",
        body={'type': "json", 'doc': "A json object"},
        httpMethod="GET",
        doc="""
See Portable Contacts for api for detailed documentation.

http://portablecontacts.net/draft-spec.html
Exemple #3
0
        description="an example exception failure",
        response={'type': 'object',
                  'description': ('throws an exception')})
    def fail(self):
        raise Exception("FAIL WHALE")

@api_entry(
    name='myapp',
    version='v1',
    description="A test wsgi api",
    title="Test API Docs",
    labels=['labs'],
    icons={'x16': 'https://mozillalabs.com/wp-content/themes/labs2.0/favicon.png'}
)
class myApp(BaseApplication):
    schema = None
    @wsgify
    def __call__(self, req):
        if not self.schema:
            generateSchema(self, req)
        return super(myApp, self).__call__(req)

with map.submapper(path_prefix='/myapp/v1') as v1:
    v1.connect('/', controller=Test)
    v1.connect('/view/{item}', controller=Test, action='view')
    v1.connect('/ok', controller=Test, action='ok')
    v1.connect('/fail', controller=Test, action='fail')


make_app = set_app(map, appKlass=myApp)
Exemple #4
0
    def fail(self):
        raise Exception("FAIL WHALE")


@api_entry(name='myapp',
           version='v1',
           description="A test wsgi api",
           title="Test API Docs",
           labels=['labs'],
           icons={
               'x16':
               'https://mozillalabs.com/wp-content/themes/labs2.0/favicon.png'
           })
class myApp(BaseApplication):
    schema = None

    @wsgify
    def __call__(self, req):
        if not self.schema:
            generateSchema(self, req)
        return super(myApp, self).__call__(req)


with map.submapper(path_prefix='/myapp/v1') as v1:
    v1.connect('/', controller=Test)
    v1.connect('/view/{item}', controller=Test, action='view')
    v1.connect('/ok', controller=Test, action='ok')
    v1.connect('/fail', controller=Test, action='fail')

make_app = set_app(map, appKlass=myApp)