Compare commits
2 Commits
30fc00b49f
...
ed016a7211
Author | SHA1 | Date |
---|---|---|
Ben Harris | ed016a7211 | |
Ben Harris | f107c145c4 |
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python3
|
||||
from http import HTTPStatus
|
||||
from sys import argv, exit, stderr
|
||||
|
||||
if len(argv) == 2:
|
||||
try:
|
||||
status = HTTPStatus(int(argv[1]))
|
||||
print(status.phrase)
|
||||
print(status.description)
|
||||
except ValueError:
|
||||
print("Invalid HTTP status code", file=stderr)
|
||||
exit(1)
|
||||
else:
|
||||
print(f"{argv[0]} [code] to print the name of the HTTP status code")
|
Loading…
Reference in New Issue