Publishing

The publish module

BookstorePublishAPIHandler

class bookstore.publish.BookstorePublishAPIHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)

Publish a notebook to the publish path

Methods

BookstorePublishAPIHandler.initialize()

Initialize a helper to get bookstore settings and session information quickly

BookstorePublishAPIHandler.put(path)

Publish a notebook on a given path.

PUT /api/bookstore/publish

The payload directly matches the contents API for PUT.

Parameters:path (str) – Path describing where contents should be published to, postfixed to the published_prefix .
BookstorePublishAPIHandler.validate_model(model)

Checks that the model given to the API handler meets bookstore’s expected structure for a notebook.

Pattern for surfacing nbformat validation errors originally written in https://github.com/jupyter/notebook/blob/a44a367c219b60a19bee003877d32c3ff1ce2412/notebook/services/contents/manager.py#L353-L355

Parameters:model (dict) – Request model for publishing describing the type and content of the object.
Raises:tornado.web.HTTPError – Your model does not validate correctly
BookstorePublishAPIHandler.prepare_response(obj, full_s3_path)

Prepares repsonse to publish PUT request.

Parameters:
  • obj (dict) – Validation dictionary for determining which endpoints to enable.
  • path – path to place after the published prefix in the designated bucket
Returns:

Model for responding to put request.

Return type:

dict