File: handlers.py

package info (click to toggle)
jupyter-notebook 4.2.3-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,800 kB
  • ctags: 2,454
  • sloc: python: 8,698; makefile: 240; sh: 74
file content (23 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Tornado handlers for api specifications."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from tornado import web
from ...base.handlers import IPythonHandler
import os

class APISpecHandler(web.StaticFileHandler, IPythonHandler):

    def initialize(self):
        web.StaticFileHandler.initialize(self, path=os.path.dirname(__file__))

    @web.authenticated
    def get(self):
        self.log.warn("Serving api spec (experimental, incomplete)")
        self.set_header('Content-Type', 'text/x-yaml')
        return web.StaticFileHandler.get(self, 'api.yaml')

default_handlers = [
    (r"/api/spec.yaml", APISpecHandler)
]