Commit 686dd5dd authored by Kirill Smelkov's avatar Kirill Smelkov

python: Make the program explicitly tell to outside this is Python version

We'll soon have several helloweb programs written in different languages
with otherwise the same output, and it is better to distinguish them for
diagnostic.
parent 88d51713
#!/usr/bin/env python #!/usr/bin/env python
"""Simple web-server that says "Hello World" for every path """Simple web-server that says "Hello World" for every path
helloweb [--logfile <logfile>] <bind-ip> <bind-port> ... helloweb.py [--logfile <logfile>] <bind-ip> <bind-port> ...
""" """
import sys import sys
...@@ -19,7 +19,7 @@ class WebHello(BaseHTTPRequestHandler): ...@@ -19,7 +19,7 @@ class WebHello(BaseHTTPRequestHandler):
self.end_headers() self.end_headers()
print >>self.wfile, \ print >>self.wfile, \
"Hello %s at `%s` ; %s" % ( "Hello %s at `%s` ; %s (python)" % (
' '.join(self.server.webhello_argv) or 'world', ' '.join(self.server.webhello_argv) or 'world',
self.path, time.asctime()) self.path, time.asctime())
...@@ -41,7 +41,7 @@ def main(): ...@@ -41,7 +41,7 @@ def main():
f = open(args.logfile, 'a', buffering=1) f = open(args.logfile, 'a', buffering=1)
sys.stderr = f sys.stderr = f
print >>sys.stderr, '* %s helloweb starting at %s' % ( print >>sys.stderr, '* %s helloweb.py starting at %s' % (
time.asctime(), (args.bind_ip, args.bind_port)) time.asctime(), (args.bind_ip, args.bind_port))
# TODO autodetect ipv6/ipv4 # TODO autodetect ipv6/ipv4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment