fork download
  1. from flask import Flask, request, jsonify
  2. import requests
  3. from multiprocessing import Process
  4.  
  5. def send_json():
  6. return requests.post("http://127.0.0.1:5000/api/v1.0/projects", json={"title":"Read a book"})
  7.  
  8. app = Flask(__name__)
  9.  
  10. def start_server():
  11. app.run(host='0.0.0.0', debug=True)
  12.  
  13. @app.route('/api/add_message/<uuid>', methods=['GET', 'POST'])
  14. def add_message(uuid):
  15. content = request.json
  16. print(content['mytext'])
  17. return jsonify({"uuid":uuid})
  18.  
  19. if __name__ == '__main__':
  20. P1 = Process(target=start_server(), debug=True)
  21. P1.start()
  22. P2 = Process(target=send_json())
  23. P2.start()
Time limit exceeded #stdin #stdout #stderr 5s 37008KB
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: 563-711-388