8 class MyHandler(BaseHTTPServer
.BaseHTTPRequestHandler
):
10 leaf
= os
.path
.basename(self
.path
)
12 self
.send_error(404, "Expected %s; got %s" % (expected
, leaf
))
14 if os
.path
.exists(leaf
):
15 self
.send_response(200)
17 self
.wfile
.write(file(leaf
).read())
20 self
.send_error(404, "Missing: %s" % leaf
)
22 def handle_requests(*script
):
23 server_address
= ('localhost', 8000)
24 httpd
= BaseHTTPServer
.HTTPServer(server_address
, MyHandler
)
30 sys
.stderr
= sys
.stdout
31 print "Waiting for request"
33 for next_step
in script
:
34 httpd
.handle_request()