pythonpython-requestshttp-status-code-304

Does requests.codes.ok include a 304?


I have a program which uses the requests module to send a get request which (correctly) responds with a 304 "Not Modified". After making the request, I check to make sure response.status_code == requests.codes.ok, but this check fails. Does requests not consider a 304 as "ok"?


Solution

  • You can check actual codes in the source. ok means 200 only.