Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace response.ok with response.status_code < 400 #309

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

shoeffner
Copy link
Contributor

The .ok is part of the requests API, but not part of the httpx API. An equivalent check, according to the requests docs, is to use response.status_code < 400 (In fact, requests' implementation is a try/except around raise_for_status, but this should be the same, although we could use the same pattern instead.)

Note that response.status_code < 400 should work with both, requests and httpx, and thus remain backwards compatible.

Closes #308.

The .ok is part of the requests API [1], but not part of the httpx API.
An equivalent check, according to the requests docs, is to use
response.status_code < 400 (In fact, requests' implementation is a try/except
around raise_for_status, but this should be the same, although we could use the
same pattern instead.)

Note that response.status_code < 400 should work with both, requests and httpx,
and thus remain backwards compatible.

  [1]: https://requests.readthedocs.io/en/latest/api/#requests.Response.ok

Closes datalad#308.
Copy link

welcome bot commented Jul 16, 2024

Thanks for opening your first pull request! We are happy to have your contributions 🎉 😄

Copy link
Member

@mih mih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense! Thanks for the PR. Even if the tests don't run ATM, I'd say we merge this and go from there. There is a significant push necessary to get things to run again with all the changes that happened.

@mih mih merged commit 3161150 into datalad:main Jul 19, 2024
2 of 4 checks passed
Copy link

welcome bot commented Jul 19, 2024

Congrats on merging your first pull request! 😎 The Datalad team is thankful for your contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add-sibling-dataverse fails with 'Response' object has no attribute 'ok'
2 participants