You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

httpServer.py 445B

123456789101112131415
  1. import http.server
  2. class EingenerHandler(http.server.BaseHTTPRequestHandler):
  3. def do_GET(self):
  4. self.send_response(200)
  5. self.end_headers()
  6. if self.path == '/':
  7. self.path = '/ying.html'
  8. msg = open(self.path[1:]).read()
  9. self.wfile.write(bytes(msg, 'utf-8'))
  10. Port = 2020
  11. Handler = EingenerHandler
  12. address = ('', Port)
  13. server = http.server.HTTPServer(address, Handler)
  14. server.serve_forever()