How to serve any file type with Python's BaseHTTPRequestHandler

后端 未结 3 1313
醉酒成梦
醉酒成梦 2021-02-13 21:06

Consider the following example:

import string,cgi,time
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

class MyHandler(         


        
3条回答
  •  旧巷少年郎
    2021-02-13 21:49

    Your line would work just fine. The problem would be setting the Content-type appropriately. You'd want to set it to application/zip instead of text/html.

提交回复
热议问题