Skip to content

Instantly share code, notes, and snippets.

@HuanMeng0
Created July 20, 2016 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HuanMeng0/96d1aabefc39d9da1b7270219f223084 to your computer and use it in GitHub Desktop.
Save HuanMeng0/96d1aabefc39d9da1b7270219f223084 to your computer and use it in GitHub Desktop.
简易的python http服务器
from BaseHTTPServer import HTTPServer,BaseHTTPRequestHandler
import shutil
class MyHttpHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write("返回内容")
return
httpd=HTTPServer(('127.0.0.1',80),MyHttpHandler)
print("Server started .....")
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment