panko.api package

Submodules

panko.api.app module

panko.api.app.app_factory(global_config, **local_conf)
panko.api.app.build_wsgi_app(argv=None)
panko.api.app.load_app(conf, appname='panko+keystone')
panko.api.app.setup_app(root, conf)

panko.api.hooks module

class panko.api.hooks.ConfigHook(conf)

Bases: pecan.hooks.PecanHook

Attach the configuration object to the request.

That allows controllers to get it.

before(state)

Override this method to create a hook that gets called after routing, but before the request gets passed to your controller.

Parameters

state – The Pecan state object for the current request.

class panko.api.hooks.DBHook(conf)

Bases: pecan.hooks.PecanHook

before(state)

Override this method to create a hook that gets called after routing, but before the request gets passed to your controller.

Parameters

state – The Pecan state object for the current request.

class panko.api.hooks.TranslationHook

Bases: pecan.hooks.PecanHook

after(state)

Override this method to create a hook that gets called after the request has been handled by the controller.

Parameters

state – The Pecan state object for the current request.

panko.api.middleware module

Middleware to replace the plain text message body of an error response with one formatted so the client can parse it.

Based on pecan.middleware.errordocument

class panko.api.middleware.ParsableErrorMiddleware(app)

Bases: object

Replace error body with something the client can parse.

static best_match_language(accept_language)

Determines best available locale from the Accept-Language header.

Returns

the best language match or None if the ‘Accept-Language’ header was not available in the request.

panko.api.rbac module

Access Control Lists (ACL’s) control access the API server.

panko.api.rbac.enforce(policy_name, request)

Return the user and project the request should be limited to.

Parameters
  • request – HTTP request

  • policy_name – the policy name to validate authz against.

panko.api.rbac.get_limited_to(headers)

Return the user and project the request should be limited to.

Parameters

headers – HTTP headers dictionary

Returns

A tuple of (user, project), set to None if there’s no limit on one of these.

panko.api.rbac.get_limited_to_project(headers)

Return the project the request should be limited to.

Parameters

headers – HTTP headers dictionary

Returns

A project, or None if there’s no limit on it.

panko.api.rbac.init()
panko.api.rbac.reset()

Module contents