requests
requests copied to clipboard
Reduce overhead of `Response.ok`
Every time ok is used it feels like it should be essentially free, but it's not as it goes through raise_for_status which does a bunch of preparatory work to manage the reason and check for the two main error categories separately.
Reduce ok to just check for what it says it does in the first line.
Also makes the behaviour consistent with the docstring: before this change ok would return True if the status code is 600 or above (which some API providers are known to do e.g. Shopify can return 783^1, LinkedIn has been known to return 999^2. However for that reason it is, technically, a breaking change.