3 ms·
I refer to HTTP Status codes all the time throughout the day and use Python's built-in http library: >>> from http import HTTPStatus >>> HTTPStatus.OK <H
by itsmemattchung 4y ago
I refer to HTTP Status codes all the time throughout the day and use Python's built-in http library:
>>> from http import HTTPStatus
>>> HTTPStatus.OK
<HTTPStatus.OK: 200>
>>> HTTPStatus(404)
<HTTPStatus.NOT_FOUND: 404>
- rlopezcc 4y agoNice. .bashrc: httpcode () { python3 -c "from http import HTTPStatus; print(HTTPStatus($1))" }
- kseistrup 4y agoOr even: HTTPStatus($1).name.title().replace('_',' ')
- kseistrup 4y agoHere's a simple CLI interface to Python's HTTP status codes: ⌘ https://codeberg.org/kas/httperr https://codeberg.org/kas/httperr