[Python-checkins] cpython: Issue #24902: Print server URL on http.server startup

berker.peksag python-checkins at python.org
Fri Apr 29 09:48:20 EDT 2016


https://hg.python.org/cpython/rev/3be61137280a
changeset:   101183:3be61137280a
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Fri Apr 29 16:48:11 2016 +0300
summary:
  Issue #24902: Print server URL on http.server startup

Initial patch by Felix Kaiser.

files:
  Lib/http/server.py |  3 ++-
  Misc/NEWS          |  3 +++
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/http/server.py b/Lib/http/server.py
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -1177,7 +1177,8 @@
     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:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -256,6 +256,9 @@
 Library
 -------
 
+- Issue #24902: Print server URL on http.server startup.  Initial patch by
+  Felix Kaiser.
+
 - Issue #25788: fileinput.hook_encoded() now supports an "errors" argument
   for passing to open.  Original patch by Joseph Hackman.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list