Compare commits

...

2 Commits

Author SHA1 Message Date
Ben Harris ed016a7211 print desc from httpstatus 2022-07-29 15:52:59 -04:00
Ben Harris f107c145c4 add lil http status code script 2022-07-29 15:44:02 -04:00
1 changed files with 14 additions and 0 deletions

14
bin/bin/httpstatus Executable file
View File

@ -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")