X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=examples%2Fping_pong_ns%2Fping_pong_ns%2Futil%2Futil.py;fp=examples%2Fping_pong_ns%2Fping_pong_ns%2Futil%2Futil.py;h=66c11fcb906a015e9bd3e2e50413c97ce0f1922e;hb=6f07e6f33f751ab4ffe624f6037f887b243bece2;hp=0000000000000000000000000000000000000000;hpb=72a563886272088feb7cb52e4aafbe6d2c580ff9;p=osm%2FSO.git diff --git a/examples/ping_pong_ns/ping_pong_ns/util/util.py b/examples/ping_pong_ns/ping_pong_ns/util/util.py new file mode 100644 index 00000000..66c11fcb --- /dev/null +++ b/examples/ping_pong_ns/ping_pong_ns/util/util.py @@ -0,0 +1,38 @@ +# +# Copyright 2016 RIFT.IO Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from datetime import date +import urlparse + +import tornado.web + +class VersionHandler(tornado.web.RequestHandler): + def initialize(self, instance): + self._instance = instance + + def get(self): + response = { 'version': '3.5.1', + 'last_build': date.today().isoformat() } + self.write(response) + +def get_url_target(url): + is_operation = False + url_parts = urlparse.urlsplit(url) + whole_url = url_parts[2] + + url_pieces = whole_url.split("/") + + return url_pieces[-1]