New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http.server: on startup, show host/port as URL #69090
Comments
http.server: on startup, show host/port as URL Old: % python3 -m http.server New: % ./python -m http.server This is useful because (modern) terminals will auto-detect URLs and make them clickable, so printing an URL makes it easier to navigate the browser there. |
This is a nice idea, but I think it would be better to add it to the message rather than change the message (and we'd still break some people's programs, I'm sure): Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000) ... |
I'm not sure - that'd be redundant, and I find it harder to read. It also breaks for badly configured terminals where "("/")" are part of the select-by-word character set (but thats a very minor issue -- users with parentheses in the set will probably be used to broken links). Here's a new patch though. Your choice :-) As for breaking programs: that message is clearly intended for human consumption. My opinion is that if someone parses that, they deserve the opportunity to fix their code. However, out of curiosity, I did search for code containing "Serving HTTP on" before opening the issue and couldn't find anything that's parsing that message. |
I do it in a number of test suites (you pass in localhost and port 0, then parse the output to find out what port got used). I'm sure other people do it as well. The parens could be dropped. I don't think it is really redundant, as the two ways of presenting the info hit different parts of my brain: one is the part that looks at things from a networking perspective (ports and IPs) and the other that looks at it from a web perspective (urls). |
FWIW, I like Felix's original suggestion. |
So do I, but I can live with either way. Can one of you merge one of these patches? |
New changeset 3be61137280a by Berker Peksag in branch 'default': |
I replaced %-string with str.format(). Thanks! Note: Please sign the PSF contributor agreement at https://www.python.org/psf/contrib/contrib-form/ |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: