• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2015 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import cherrypy
6
7
8META_HANDLER_PATH = 'meta'
9
10
11class MetaHandler(object):
12    """Exposes meta methods related to the server."""
13
14    # Needed for cherrypy to expose this to requests.
15    exposed = True
16
17    def __init__(self, generation):
18        """Construct an instance.
19
20        @param generation: string unique token for this server (e.g. a UUID).
21
22        """
23        self._generation = generation
24
25    def GET(self, *args, **kwargs):
26        """Handle GET requests to this URL."""
27        if ['generation'] == list(args):
28            return self._generation
29        cherrypy.response.status = 400
30        return ''
31