Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import time
  2.  
  3. def api1(start_response):
  4. starttime = time.strftime("%H:%M:%S")
  5. time.sleep(10)
  6. endtime = time.strftime("%H:%M:%S")
  7. start_response("200 OK", [("Content-type", "text/plain")])
  8. return "api1: " + starttime + " - " + endtime
  9.  
  10. def api2(start_response):
  11. starttime = time.strftime("%H:%M:%S")
  12. time.sleep(10)
  13. endtime = time.strftime("%H:%M:%S")
  14. start_response("200 OK", [("Content-type", "text/plain")])
  15. return "api2: " + starttime + " - " + endtime
  16.  
  17. def application(environ, start_response):
  18. path = environ["PATH_INFO"]
  19. if path == "/api1":
  20. return api1(start_response)
  21. elif path == "/api2":
  22. return api2(start_response)
  23.  
  24. [uwsgi]
  25. processes = 3
  26. threads = 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement