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

get_*(): replace httr by httr2? #48

Open
dimfalk opened this issue Nov 5, 2022 · 0 comments
Open

get_*(): replace httr by httr2? #48

dimfalk opened this issue Nov 5, 2022 · 0 comments
Assignees
Labels
enhancement Refactoring and restyling of existing code prio: low

Comments

@dimfalk
Copy link
Owner

dimfalk commented Nov 5, 2022

https://github.com/r-lib/httr2

Major differences:

  • You can now create and modify a request without performing it. This means that there’s now a single function to perform the request and fetch the result: req_perform(). req_perform() replaces httr::GET(), httr::POST(), httr::DELETE(), and more.

  • HTTP errors are automatically converted into R errors. Use req_error() to override the defaults (which turn all 4xx and 5xx responses into errors) or to add additional details to the error message.

  • You can automatically retry if the request fails or encounters a transient HTTP error (e.g. a 429 rate limit request). req_retry() defines the maximum number of retries, which errors are transient, and how long to wait between tries.

  • OAuth support has been totally overhauled to directly support many more flows and to make it much easier to both customise the built-in flows and to create your own.

  • You can manage secrets (often needed for testing) with secret_encrypt() and friends. You can obfuscate mildly confidential data with obfuscate(), preventing it from being scraped from published code.

  • You can automatically cache all cacheable results with req_cache(). Relatively few API responses are cacheable, but when they are it typically makes a big difference.

https://httr2.r-lib.org/articles/wrapping-apis.html#secret-management

@dimfalk dimfalk added enhancement Refactoring and restyling of existing code prio: low labels Nov 5, 2022
@dimfalk dimfalk self-assigned this Nov 5, 2022
@dimfalk dimfalk changed the title get_*(): replace httr by httr2 get_*(): replace httr by httr2? Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Refactoring and restyling of existing code prio: low
Projects
None yet
Development

No branches or pull requests

1 participant