API v2 not handling response body errors correctly for missing reference tweets
Closed this issue · 1 comments
MKatz-DHSC commented
Problem
Errors in the response body due to missing referenced tweets on v2 API are not handled correctly by the package giving a ! is.list(x) is not TRUE
Details
Need to change req_errors
in api_v2_utils.R as API can return a data frame (not list) as response body error so causes the code to fail on line 113
Bad section:
if (any(lengths(r$errors) > 1)) {
# below is bad line
errors <- do.call(rbind, lapply(r$errors, list2DF))
} else {
errors <- r$errors
}
Reproduce the problem
rtweet::user_liked_tweets(
id = "61183568",
n = 200,
expansions = rtweet::set_expansions(
tweet = "referenced_tweets.id",
user = NULL,
list = NULL
),
token = NULL,
parse = FALSE
)
rtweet version
1.2.1
llrs commented
Thanks for the reports, I'll look at them shortly (I was about to submit the new version to CRAN).
Unfortunately, I cannot reproduce it as I am not paying the "basic" subscription to the API.
It would help if you provided some funds or the patch to fix them. Thanks.