I'm trying to write a block of code to return the meaning (description) of an HTTP status code using the http.HTTPStatus Python class. I read the docs, but it seems I can only do the reverse. Is there way I can do this?
try:
if resp.status != 200:
message =
CodePudding user response:
I don't understand what is your problem.
Code
import http
print( http.HTTPStatus(404).name )
gives description
'NOT_FOUND'