Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from wsgiref.simple_server import make_server
- import random
- def application(env, start_response):
- """
- A basic WSGI application
- """
- if random.random() < 0.5:
- status = "200 OK"
- else:
- status = "502 Bad Gateway"
- headers = [
- ('Content-Type', 'application/json'),
- ('X-WP-TotalPages', '0'),
- ('X-WP-Total', '0'),
- ]
- start_response(status, headers)
- return ["[]".encode('utf-8')]
- if __name__ == "__main__":
- make_server('', 80, application).serve_forever()
Add Comment
Please, Sign In to add comment