| """ |
| SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org> |
| SPDX-License-Identifier: LicenseRef-ONF-Member-1.01 |
| """ |
| import sys |
| |
| from flask import Flask, request |
| from flask_restful import Resource, Api |
| import logging as log |
| |
| app = Flask(__name__) |
| api = Api(app) |
| |
| |
| class Greeting(Resource): |
| def get(self): |
| return 'Hello World!' |
| |
| |
| api.add_resource(Greeting, '/') # Route_1 |
| |
| if __name__ == '__main__': |
| log.basicConfig( |
| format='%(asctime)s %(levelname)-8s %(message)s', |
| level=log.DEBUG, |
| datefmt='%Y-%m-%d %H:%M:%S', |
| stream=sys.stdout) |
| |
| log.info("Starting network-diag-app...") |
| |
| app.run('0.0.0.0', '3333') |