Last active
May 28, 2016 15:45
-
-
Save srid99/2f902f058c274f4189bcce26f2f1a869 to your computer and use it in GitHub Desktop.
Simple python server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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