Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Commit

Permalink
Tweak error handling and cache on disk
Browse files Browse the repository at this point in the history
  • Loading branch information
llrs committed Feb 19, 2024
1 parent 7f371c7 commit 40e0248
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/api_v2_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ req_errors <- function(resp) {

if (any(lengths(r$errors) > 1)) {
if (is.data.frame(r$errors[[1]])) {
errors <- do.call(rbind, r$errors)
errors <- r$errors
} else {
errors <- do.call(rbind, lapply(r$errors, list2DF))
}
Expand Down Expand Up @@ -144,7 +144,8 @@ req_v2 <- function(scopes) {
auth_url = "https://twitter.com/i/oauth2/authorize",
pkce = TRUE,
scope = paste(scopes_client, collapse = " "),
redirect_uri = "http://127.0.0.1:1410"
redirect_uri = "http://127.0.0.1:1410",
cache_disk = TRUE
# redirect_uri = "http://localhost:1410"
)

Expand All @@ -153,7 +154,7 @@ req_v2 <- function(scopes) {
req_try <- httr2::req_retry(req_content,
is_transient = twitter_is_transient,
after = twitter_after)
req <- httr2::req_error(req_try, is_error = req_is_error, body = req_errors)
req <- httr2::req_error(req_try, is_error = httr2::resp_is_error, body = req_errors)
req
}

Expand Down

0 comments on commit 40e0248

Please sign in to comment.