IPython Documentation

Table Of Contents

Previous topic

Module: html.services.contents.filemanager

Next topic

Module: html.services.contents.manager

This Page

Note

This documentation is for a development version of IPython. There may be significant differences from the latest stable release.

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.IPythonHandler

delete(*args, **kwargs)

delete a file in the given path

get(*args, **kwargs)

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(name, path)

Return the full URL location of a file.

Parameters:

name : unicode

The base name of the file, such as “foo.ipynb”.

path : unicode

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

patch(*args, **kwargs)

PATCH renames a notebook without re-uploading content.

post(*args, **kwargs)

Create a new file or directory in the specified path.

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

POST /api/contents/path
New untitled notebook in path. If content specified, upload a notebook, otherwise start empty.
POST /api/contents/path
with body {“copy_from” : “OtherNotebook.ipynb”} New copy of OtherNotebook in path
put(*args, **kwargs)

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.
PUT /api/contents/path/Name.ipynb

with JSON body:

{
  "copy_from" : "[path/to/]OtherNotebook.ipynb"
}

Copy OtherNotebook to Name

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

Bases: IPython.html.base.handlers.IPythonHandler

get(*args, **kwargs)

get lists checkpoints for a file

post(*args, **kwargs)

post creates a new checkpoint

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

Bases: IPython.html.base.handlers.IPythonHandler

delete(*args, **kwargs)

delete clears a checkpoint for a given file

post(*args, **kwargs)

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

1 Function

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

key function for case-insensitive sort by name and type