Skip to content

Commit

Permalink
REST endpoint: Tornado version, versions only in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
larsmans committed Feb 23, 2015
1 parent 88b8f15 commit 5391dc6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions xtas/webserver/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from flask import Flask, Response, abort, request
from flask import __version__ as flask_version

from tornado import version as tornado_version
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
Expand All @@ -25,14 +26,14 @@

@app.route("/")
def home():
# XXX should do this only in debug mode or when key is given to prevent
# attacks on specific Flask versions.
pyver = sys.version_info
text = '\n'.join(["xtas web server\n",
"Python version %d.%d.%d" % (pyver.major, pyver.minor,
pyver.micro),
"Celery version %s" % celery_version,
"Flask version %s" % flask_version])
text = "xtas web server\n"
if app.debug:
text += '\n'.join(["\nPython version %d.%d.%d"
% (pyver.major, pyver.minor, pyver.micro),
"Celery version %s" % celery_version,
"Flask version %s" % flask_version,
"Tornado version %s" % tornado_version])
return Response(text, mimetype="text/plain")


Expand Down

0 comments on commit 5391dc6

Please sign in to comment.