forked from opensearch-project/opensearch-api-specification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
31 lines (25 loc) · 927 Bytes
/
server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
from http.server import BaseHTTPRequestHandler, HTTPServer
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "application_json")
self.end_headers()
self.wfile.write(b'{"ok":"true"}')
def do_POST(self):
self.send_response(200)
self.send_header("Content-type", "application_json")
self.end_headers()
self.wfile.write(b'{"ok":"true"}')
if __name__ == "__main__":
server_address = ("", 8080)
httpd = HTTPServer(server_address, SimpleHTTPRequestHandler)
print("Server started on http://localhost:8080")
httpd.serve_forever()