flaskServer.py 2.4 KB

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