def run_server(self): BaseHTTPServer((IP, 9999), BaseHTTPRequestHandler).serve_forever()
def __init__(self, server_address, handler_class): self.server_name = 'SimpleHTTPServer' self.version = 'v0.1' BaseHTTPServer.__init__(self, server_address, handler_class)
from handler.simple_http_handler import SimpleHTTPHandler from server.base_http_server import BaseHTTPServer if __name__ == '__main__': HOST = '127.0.0.1' PORT = 8888 BaseHTTPServer((HOST, PORT), SimpleHTTPHandler).serve_forever()
417: ('Expectation Failed', 'Expect condition could not be satisfied.'), 500: ('Internal Server Error', 'Server got itself in trouble'), 501: ('Not Implemented', 'Server does not support this operation'), 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'), 503: ('Service Unavailable', 'The server cannot process the request due to a high load'), 504: ('Gateway Timeout', 'The gateway server did not receive a timely response'), 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'), } def guess_type(self, path): if not mimetypes.inited: mimetypes.init() base, ext = posixpath.splitext(path) if ext in mimetypes.types_map: return mimetypes.types_map[ext] ext = ext.lower() if ext in mimetypes.types_map: return mimetypes.types_map[ext] else: return 'text/plain' if __name__ == '__main__': from server.base_http_server import BaseHTTPServer BaseHTTPServer(('127.0.0.1', 9999), BaseHTTPRequestHandler).serve_forever()
def run_server(self): BaseHTTPServer(('127.0.0.1', 9999), BaseHTTPRequestHandler).serve_forever()
def __init__(self, server_address, handler_class): self.server_name = "SimpleHTTPServer" self.version = "v0.5" BaseHTTPServer.__init__(self, server_address, handler_class)