summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-04-29 13:48:11 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-04-29 13:48:11 (GMT)
commit3a31cca4abdfdc4d623deb7e8c4be58b5ca936eb (patch)
tree34f72a6300558b52ee6cff23a8094103dc5a4e36 /Lib/http
parent955bc38b16abd6f98f534337675b04f23e13124f (diff)
downloadcpython-3a31cca4abdfdc4d623deb7e8c4be58b5ca936eb.zip
cpython-3a31cca4abdfdc4d623deb7e8c4be58b5ca936eb.tar.gz
cpython-3a31cca4abdfdc4d623deb7e8c4be58b5ca936eb.tar.bz2
Issue #24902: Print server URL on http.server startup
Initial patch by Felix Kaiser.
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/server.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 1f6a62b..bd94eaa 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -1177,7 +1177,8 @@ def test(HandlerClass=BaseHTTPRequestHandler,
HandlerClass.protocol_version = protocol
with ServerClass(server_address, HandlerClass) as httpd:
sa = httpd.socket.getsockname()
- print("Serving HTTP on", sa[0], "port", sa[1], "...")
+ serve_message = "Serving HTTP on {host} port {port} (http://{host}:{port}/) ..."
+ print(serve_message.format(host=sa[0], port=sa[1]))
try:
httpd.serve_forever()
except KeyboardInterrupt: