get_root(app, request=None)[source]

Return a tuple composed of (root, closer) when provided a router instance as the app argument. The root returned is the application root object. The closer returned is a callable (accepting no arguments) that should be called when your scripting application is finished using the root. If request is not None, it is used as the request passed to the Pyramid application root factory. A request is constructed and passed to the root factory if request is None.