google.appengine.api.apiproxy_stub_map.ListOfHooks

An ordered collection of hooks for a particular API call.

Inherits From: expected_type

A hook is a function that has exactly the same signature as a service stub. It will be called before or after an API hook is executed, depending on whether this list is for precall of postcall hooks. Hooks can be used for debugging purposes (check certain pre- or postconditions on api calls) or to apply patches to protocol buffers before/after a call gets submitted.

Methods

Append

View source

Appends a hook at the end of the list.

Args
key A unique key (within the module) for this particular function. If something from the same module with the same key is already registered, nothing will be added.
function The hook to be added.
service Optional argument that restricts the hook to a particular API.

Returns
True if the collection was modified.

Call

View source

Invokes all hooks in this collection.

NOTE: For backwards compatibility, if error is not None, hooks with 4 or 5 arguments are not called. This situation (error=None) only occurs when the RPC request raised an exception; in the past no hooks would be called at all in that case.

Args
service string. Represents which service to call.
call string. Representswhich function to call.
request Protocol buffer for the request.
response Protocol buffer for the response.
rpc Optional RPC used to make this call.
error Optional Exception instance to be passed as sixth argument.

Clear

View source

Removes all hooks from the list (useful for unit tests).

Push

View source

Inserts a hook at the beginning of the list.

Args
key A unique key (within the module) for this particular function. If something from the same module with the same key is already registered, nothing will be added.
function The hook to be added.
service Optional argument that restricts the hook to a particular API.

Returns
True if the collection was modified.

__len__

View source

Returns the amount of elements in the collection.