In the Requests module of Python, we can check the response of a request as below:
>>> resp = requests.get("https://stackoverflow.com")
>>> resp.status_code == 200
True
>>> resp.status_code == requests.codes.OK
True
>>>
What can I do if I just need to check if the response that came, is a part of the HTTP sub-codes , viz.,
1xx (Informational responses)
2xx (Success)
3xx (Redirection)
4xx (Client errors)
5xx (Server errors)
resp.status_code // 100 == 2