mirror of https://tildegit.org/ben/dotfiles
add lil http status code script
parent
30fc00b49f
commit
f107c145c4
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
from http import HTTPStatus
|
||||||
|
from sys import argv, exit, stderr
|
||||||
|
|
||||||
|
if len(argv) == 2:
|
||||||
|
try:
|
||||||
|
print(HTTPStatus(int(argv[1])).name.title().replace("_", " "))
|
||||||
|
except ValueError:
|
||||||
|
print("Not a valid 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