Warning

This documentation is for an old version of IPython. You can find docs for newer versions here.

Module: html.services.contents.handlers

Tornado handlers for the contents web service.

4 Classes

class IPython.html.services.contents.handlers.ContentsHandler(application, request, **kwargs)

Bases: IPython.html.base.handlers.APIHandler

delete(path='')

delete a file in the given path

get(path='')

Return a model for a file or directory.

A directory model contains a list of models (without content) of the files and directories it contains.

location_url(path)

Return the full URL location of a file.

Parameters:

path : unicode

The API path of the file, such as “foo/bar.txt”.

patch(path='')

PATCH renames a file or directory without re-uploading content.

post(path='')

Create a new file in the specified path.

POST creates new files. The server always decides on the name.

POST /api/contents/path
New untitled, empty file or directory.
POST /api/contents/path
with body {“copy_from” : “/path/to/OtherNotebook.ipynb”} New copy of OtherNotebook in path
put(path='')

Saves the file in the location specified by name and path.

PUT is very similar to POST, but the requester specifies the name, whereas with POST, the server picks the name.

PUT /api/contents/path/Name.ipynb
Save notebook at path/Name.ipynb. Notebook structure is specified in content key of JSON request body. If content is not specified, create a new empty notebook.
class IPython.html.services.contents.handlers.CheckpointsHandler(application, request, **kwargs)

Bases: IPython.html.base.handlers.APIHandler

get(path='')

get lists checkpoints for a file

post(path='')

post creates a new checkpoint

class IPython.html.services.contents.handlers.ModifyCheckpointsHandler(application, request, **kwargs)

Bases: IPython.html.base.handlers.APIHandler

delete(path, checkpoint_id)

delete clears a checkpoint for a given file

post(path, checkpoint_id)

post restores a file from a checkpoint

class IPython.html.services.contents.handlers.NotebooksRedirectHandler(application, request, **kwargs)

Bases: IPython.html.base.handlers.IPythonHandler

Redirect /api/notebooks to /api/contents

2 Functions

IPython.html.services.contents.handlers.sort_key(model)

key function for case-insensitive sort by name and type

IPython.html.services.contents.handlers.validate_model(model, expect_content)

Validate a model returned by a ContentsManager method.

If expect_content is True, then we expect non-null entries for ‘content’ and ‘format’.