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

Switch from httr to httr2 #273

Closed
pitkant opened this issue Sep 7, 2023 · 2 comments · Fixed by #276
Closed

Switch from httr to httr2 #273

pitkant opened this issue Sep 7, 2023 · 2 comments · Fixed by #276

Comments

@pitkant
Copy link
Member

pitkant commented Sep 7, 2023

eurostat package currently depends on httr (httr (>= 1.4.0)) but on httr website it is stated that

httr is superseded: only changes necessary to keep it on CRAN will be made. We recommend using httr2 instead.

Within some time frame it would be useful to switch from httr to httr2 as httr2 is obviously under active development and therefore better supported. Some new features of httr2:

The main differences with httr are (from Vaarle van Leemput's LinkedIn post:

  • httr2 has a pipeable API
  • there’s a single function now to perform a request and fetch the result: 𝚛𝚎𝚚_𝚙𝚎𝚛𝚏𝚘𝚛𝚖(). You can now create and modify a request without performing it too (e.g. with 𝚛𝚎𝚚_𝚍𝚛𝚢_𝚛𝚞𝚗())
  • HTTP errors are now R errors, super convenient as the errors will just nicely display in the console
  • Better management of secrets
  • You can cache cacheable results
  • Better OAuth support
  • You can automatically retry requests with 𝚛𝚎𝚚_𝚛𝚎𝚝𝚛𝚢()

However I don't think this switch is very urgent as superseded does not mean that httr would be deprecated. On the contrary, it is stated that necessary changes will be made if it was at risk of being booted from CRAN. httr2 is not a new package but in 2022 it was described as an "experimental successor to httr" by its author Hadley Wickham. Although I think he didn't mean the package being experimental as in being unstable (the core functions are probably going to be very stable and dependable) but more like the package is still getting new functionalities and is under active development.

It wouldn't probably be a big task to replace all httr function calls with httr2 calls but the question here is whether we want to do it immediately or wait a bit. What do others think?

@pitkant pitkant linked a pull request Sep 28, 2023 that will close this issue
@pitkant
Copy link
Member Author

pitkant commented Sep 29, 2023

Now merged into v4-dev, feedback very much welcome

@pitkant pitkant mentioned this issue Nov 3, 2023
@pitkant
Copy link
Member Author

pitkant commented Dec 20, 2023

Closed with the CRAN release of package version 4.0.0

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

Successfully merging a pull request may close this issue.

1 participant