ViewerHandle

Qualified name: algan.viewer.viewer.ViewerHandle

class ViewerHandle(server, session)[source]

Bases: object

A running viewer, and the means to stop it.

Returned by view(). Also a context manager, so a script can open a viewer for as long as it needs one and be sure the port is released.

Methods

serve_forever

Serve on this thread until stop() is called.

start

Serve on a background thread and return immediately.

stop

Stop serving and release the port.

url_for

One route's full URL, with this session's token attached.

Attributes

session

The viewer's own handle on the Scene, for tests and scripting.

url

The address the viewer is served at, session token included.

serve_forever()[source]

Serve on this thread until stop() is called.

Return type:

None

property session: ViewerSession

The viewer’s own handle on the Scene, for tests and scripting.

start()[source]

Serve on a background thread and return immediately.

Return type:

ViewerHandle

stop()[source]

Stop serving and release the port.

Return type:

None

property url: str

The address the viewer is served at, session token included.

url_for(path)[source]

One route’s full URL, with this session’s token attached.

Every route but the page itself needs the token, and url already carries a query string, so a script or a test addressing the API asks for its URL here rather than concatenating onto that one.

Parameters:

path (str)

Return type:

str