flaskServer2.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Wed Nov 20 16:17:30 2019
  4. @author: Honza
  5. """
  6. from flask import Flask, request, jsonify
  7. import threading
  8. class flaskServer(object):
  9. data = 'foo'
  10. print (data)
  11. app = Flask(__name__)
  12. app.run(host='0.0.0.0', port=3000)
  13. # threading.Thread(target=app.run).start()
  14. @app.route("/")
  15. def main():
  16. print(data)
  17. return "Layman"
  18. # @app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
  19. # def form_to_json(self):
  20. # data = request.form.to_dict(flat=False)
  21. # code = request.args.get('code')
  22. #
  23. # return (code)
  24. # def startServer():
  25. # print("test")
  26. # app.run(host='0.0.0.0', port=3000)
  27. #if __name__ == "__main__":
  28. # print("flask is starting")
  29. # threading.Thread(target=app.run).start()
  30. #app = Flask(__name__)
  31. #app.run(host='0.0.0.0', port=3000)
  32. ##def __init__(self):
  33. ## app = Flask(__name__)
  34. ## #if __name__ == '__main__':
  35. ## app.run(host='0.0.0.0', port=3000)
  36. #@app.route('/')
  37. #def hello():
  38. # return "Hello World!"
  39. #@app.route('/<name>')
  40. #def hello_name(name):
  41. # return "Hello {}!".format(name)
  42. #@app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
  43. ##def get_text():
  44. ## return "some text"
  45. ##def add():
  46. ## data = request.get_json()
  47. # # ... do your business logic, and return some response
  48. # # e.g. below we're just echo-ing back the received JSON data
  49. # # print (jsonify(data))
  50. # # print (request.headers)
  51. # # print (request.__dict__)
  52. # print (request.data)
  53. # return jsonify(data)
  54. #def form_to_json(self):
  55. # data = request.form.to_dict(flat=False)
  56. # code = request.args.get('code')
  57. # return jsonify(data)
  58. # return (code)