Added demo web application
This application will be executed on the VM and will response on API requests from Mistral. Change-Id: I8c58a819d738465149ba5cc23ee46ba8a4e639fd
This commit is contained in:
parent
0f91da10f6
commit
cc5da8e92e
|
@ -0,0 +1,38 @@
|
|||
# Copyright 2013 Mirantis, 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.
|
||||
|
||||
import flask
|
||||
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
host = "0.0.0.0"
|
||||
port = 5000
|
||||
|
||||
|
||||
@app.route('/summ')
|
||||
def summ():
|
||||
summ = 0
|
||||
args = flask.request.args.get('arguments', [], type=list)
|
||||
|
||||
for a in args:
|
||||
try:
|
||||
summ += int(a)
|
||||
except:
|
||||
return 403, "Sorry, need to use only integer arguments!"
|
||||
|
||||
return flask.jsonify({'result': summ})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host=host, port=port)
|
|
@ -7,3 +7,4 @@ WSME>=0.5b6
|
|||
argparse
|
||||
oslo.config>=1.2.0
|
||||
python-keystoneclient
|
||||
flask
|
||||
|
|
Loading…
Reference in New Issue