cozy.server — cozy 1.1 documentation

# `cozy.server`

## Module Contents

### Classes

`VizHandler` | Simple HTTP request handler with GET and HEAD commands.

### Functions

`get_vizroot`() |
`start_viz_server`([pre, post, open_browser, port]) | Serves Cozy-Viz on localhost:8080.

cozy.server.get_vizroot()

class cozy.server.VizHandler(prepatch, postpatch, *args, **kwargs)

  Bases: `http.server.SimpleHTTPRequestHandler`

  Simple HTTP request handler with GET and HEAD commands.

  This serves files from the current directory and any of its subdirectories. The MIME type for files is determined by calling the .guess_type() method.

  The GET and HEAD requests are identical except that the HEAD request omits the actual contents of the file.

  do_GET()

    Serve a GET request.

cozy.server.start_viz_server(pre={}, post={}, open_browser=False, port=8080)

  Serves Cozy-Viz on localhost:8080.

  Useful for visualization of information generated using `cozy.execution_graph.compare_and_dump()`.

  To include comparison data, use the pre and post arguments, and add a query string to the URL, like so: localhost:8080?pre=/pre&post=/post.

  Parameters:

    - pre (dict, optional) – served as JSON at /pre on the server. Default {}.

    - post (dict, optional) – served as JSON at /post on the server. Default {}.

    - port (int, optional) – An alternative port to serve on. Default 8080.