Skip to content

Instantly share code, notes, and snippets.

@srid99
Last active May 28, 2016 15:45
Show Gist options
  • Save srid99/2f902f058c274f4189bcce26f2f1a869 to your computer and use it in GitHub Desktop.
Save srid99/2f902f058c274f4189bcce26f2f1a869 to your computer and use it in GitHub Desktop.
Simple python server
#!/usr/bin/python
from wsgiref.simple_server import make_server
def application(environ, start_response):
response_body = '{"id": 1}'
status = '200 OK'
response_headers = [('Content-Type', 'application/json'),
('Content-Length', str(len(response_body)))]
start_response(status, response_headers)
return [response_body]
httpd = make_server('localhost', 8000, application)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment