fork download
  1. from flask import Flask, request, jsonify
  2. import requests
  3. from multiprocessing import Process
  4.  
  5. def send_json(content):
  6. return requests.post("http://127.0.0.1:5000/api/v1.0/projects", json=content)
  7.  
  8. app = Flask(__name__)
  9.  
  10. @app.route('/api/add_message/<uuid>', methods=['GET', 'POST'])
  11. def add_message(uuid):
  12. content = request.json
  13. print(content['mytext'])
  14. return jsonify({"uuid":uuid})
  15.  
  16. if __name__ == '__main__':
  17. P1 = Process(target=app.run(host= '0.0.0.0',debug=True))
  18. P1.start()
  19. P2 = Process(target=send_json({"title":"Read a book"}))
  20. P2.start()
Time limit exceeded #stdin #stdout #stderr 5s 37172KB
stdin
Standard input is empty
stdout
 * Serving Flask app "prog" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
stderr
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 285-874-851