StackInABoxService Router

StackInABoxService uses a custom router to differentiate between method and sub-service routing. This is entirely an internal object.

import stackinabox.services.service

router = stackinabox.services.service.StackInABoxServiceRouter
class stackinabox.services.service.StackInABoxServiceRouter(name, uri, obj, parent_obj)

Stack-In-A-Box Service Router object.

Advanced URI routing to support Service-within-Service routing

is_subservice

Is the object managing a sub-service.

register_method(method, fn)

Register an HTTP method and handler function.

Parameters:
  • method – string, HTTP verb
  • fn – python function handling the request
Raises:

RouteAlreadyRegisteredError if the route is already registered

Returns:

n/a

set_subservice(obj)

Add a sub-service object.

Parameters:obj – stackinabox.services.StackInABoxService instance
Raises:RouteAlreadyRegisteredError if the route is already registered
Returns:n/a
update_uris(new_uri)

Update all URIS.

Parameters:new_uri – URI to switch to and update the matching
Returns:n/a

Note: This overwrites any existing URI