The watcher.api.hooks Module

class watcher.api.hooks.ContextHook[source]

Bases: pecan.hooks.PecanHook

Configures a request context and attaches it to the request.

The following HTTP request headers are used:

X-User:
Used for context.user.
X-User-Id:
Used for context.user_id.
X-Project-Name:
Used for context.project.
X-Project-Id:
Used for context.project_id.
X-Auth-Token:
Used for context.auth_token.
before(state)[source]
class watcher.api.hooks.NoExceptionTracebackHook[source]

Bases: pecan.hooks.PecanHook

Workaround rpc.common: deserialize_remote_exception.

deserialize_remote_exception builds rpc exception traceback into error message which is then sent to the client. Such behavior is a security concern so this hook is aimed to cut-off traceback from the error message.

after(state)[source]