-
-
Save dsolstad/561181eea26d0aa3fb69c699ea3b8e78 to your computer and use it in GitHub Desktop.
A simple HTTP Server supporting put
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python -m SimpleHTTPPutServer 8080 | |
import SimpleHTTPServer | |
import BaseHTTPServer | |
class SputHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_PUT(self): | |
print self.headers | |
length = int(self.headers["Content-Length"]) | |
path = self.translate_path(self.path) | |
with open(path, "wb") as dst: | |
dst.write(self.rfile.read(length)) | |
if __name__ == '__main__': | |
SimpleHTTPServer.test(HandlerClass=SputHTTPRequestHandler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment