Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reduce overhead ofResponse.ok#6989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
xmo-odoo wants to merge1 commit intopsf:main
base:main
Choose a base branch
Loading
fromxmo-odoo:patch-1
Open

Conversation

xmo-odoo
Copy link

Every timeok is used it feels like it should be essentially free, but it's not as it goes throughraise_for_status which does a bunch of preparatory work to manage the reason and check for the two main error categories separately.

Reduceok to just check for what it says it does in the first line.

Also makes the behaviour consistent with the docstring: before this changeok would returnTrue if the status code is 600 or above (which some API providers are known to do e.g. Shopify can return 7831, LinkedIn has been known to return 9992. However for that reason it is, technically, a breaking change.

Footnotes

  1. https://shopify.dev/docs/api/usage/response-codes

  2. https://stackoverflow.com/questions/27231113/999-error-code-on-head-request-to-linkedin

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.[^1]:https://shopify.dev/docs/api/usage/response-codes[^2]:https://stackoverflow.com/questions/27231113/999-error-code-on-head-request-to-linkedin
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@xmo-odoo

[8]ページ先頭

©2009-2025 Movatter.jp