ropensci / rfishbase

R interface to the fishbase.org database
https://docs.ropensci.org/rfishbase
111 stars 40 forks source link

Getting and API error with the species() function #238

Closed jepa closed 2 years ago

jepa commented 2 years ago

Hello,

Me and my colleagues are getting the following error when using the species() function

rfishbase::species("gadus morhua")
Error in gh_process_response(raw) : 
GitHub API error (401): 
Message: Bad credentials
Read more at https://docs.github.com/rest

When you run the .Last.error.trace function you get the following:

$calls
$calls[[1]]
rfishbase::species("gadus morhua")

$calls[[2]]
fb_tbl(endpt, server, version, db) %>% fix_ids()

$calls[[3]]
fix_ids(.)

$calls[[4]]
"Speccode" %in% colnames(full_data)

$calls[[5]]
colnames(full_data)

$calls[[6]]
is.data.frame(x)

$calls[[7]]
fb_tbl(endpt, server, version, db)

$calls[[8]]
tbl_name(tbl, server, version)

$calls[[9]]
paste(tbl, prefix(server), gsub("\\.", "", version), sep = "_")

$calls[[10]]
gsub("\\.", "", version)

$calls[[11]]
is.factor(x)

$calls[[12]]
get_latest_release()

$calls[[13]]
available_releases()

$calls[[14]]
gh::gh("/repos/:owner/:repo/releases", owner = "ropensci", repo = "rfishbase", 
    .token = token) %>% purrr::map_chr("tag_name") %>% stringr::str_extract("\\d\\d\\.\\d\\d") %>% 
    as.numeric() %>% stats::na.omit() %>% unique() %>% sort(decreasing = TRUE) %>% 
    as.character()

$calls[[15]]
sort(., decreasing = TRUE)

$calls[[16]]
unique(.)

$calls[[17]]
stats::na.omit(.)

$calls[[18]]
stringr::str_extract(., "\\d\\d\\.\\d\\d")

$calls[[19]]
stri_extract_first_regex(string, pattern, opts_regex = opts(pattern))

$calls[[20]]
purrr::map_chr(., "tag_name")

$calls[[21]]
gh::gh("/repos/:owner/:repo/releases", owner = "ropensci", repo = "rfishbase", 
    .token = token)

$calls[[22]]
gh_process_response(raw)

$calls[[23]]
gh_error(response)

$calls[[24]]
throw(cond)

$parents
 [1]  0  1  3  3  3  5  1  7  8  8 10  1 12 13 15 16 17 18 18 20 13 21 22 23

$envs
$envs[[1]]
[1] "0x7f8f505e8d60"

$envs[[2]]
[1] "0x7f8f505e8af8"

$envs[[3]]
[1] "0x7f8f505e84d8"

$envs[[4]]
[1] "0x7f8f505e8388"

$envs[[5]]
[1] "0x7f8f505e8200"

$envs[[6]]
[1] "0x7f8f505e80b0"

$envs[[7]]
[1] "0x7f903fc99878"

$envs[[8]]
[1] "0x7f903fc99648"

$envs[[9]]
[1] "0x7f903fc99300"

$envs[[10]]
[1] "0x7f903fc98570"

$envs[[11]]
[1] "0x7f903fc983b0"

$envs[[12]]
[1] "0x7f903fc98340"

$envs[[13]]
[1] "0x7f903fc98308"

$envs[[14]]
[1] "0x7f903fc9ac70"

$envs[[15]]
[1] "0x7f903fc99d90"

$envs[[16]]
[1] "0x7f903fc9da38"

$envs[[17]]
[1] "0x7f903fc9d840"

$envs[[18]]
[1] "0x7f903fc9d610"

$envs[[19]]
[1] "0x7f903fc9ce68"

$envs[[20]]
[1] "0x7f903fc9cc38"

$envs[[21]]
[1] "0x7f9003983110"

$envs[[22]]
[1] "0x7f9134b42690"

$envs[[23]]
[1] "0x7f9134b41900"

$envs[[24]]
[1] "0x7f900396a2f8"

$topenvs
$topenvs[[1]]
[1] "namespace:rfishbase"

$topenvs[[2]]
[1] "namespace:magrittr"

$topenvs[[3]]
[1] "namespace:rfishbase"

$topenvs[[4]]
[1] "namespace:base"

$topenvs[[5]]
[1] "namespace:base"

$topenvs[[6]]
[1] "namespace:base"

$topenvs[[7]]
[1] "namespace:rfishbase"

$topenvs[[8]]
[1] "namespace:rfishbase"

$topenvs[[9]]
[1] "namespace:base"

$topenvs[[10]]
[1] "namespace:base"

$topenvs[[11]]
[1] "namespace:base"

$topenvs[[12]]
[1] "namespace:rfishbase"

$topenvs[[13]]
[1] "namespace:rfishbase"

$topenvs[[14]]
[1] "namespace:magrittr"

$topenvs[[15]]
[1] "namespace:base"

$topenvs[[16]]
[1] "namespace:base"

$topenvs[[17]]
[1] "namespace:stats"

$topenvs[[18]]
[1] "namespace:stringr"

$topenvs[[19]]
[1] "namespace:stringi"

$topenvs[[20]]
[1] "namespace:purrr"

$topenvs[[21]]
[1] "namespace:gh"

$topenvs[[22]]
[1] "namespace:gh"

$topenvs[[23]]
[1] "namespace:gh"

$topenvs[[24]]
[1] "0x7f91959f9a08"

$indices
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

$nframes
[1] 24

$messages
$messages[[1]]
[1] "\nGitHub API error (401): \nMessage: Bad credentials\nRead more at https://docs.github.com/rest"

$ignore
NULL

$classes
[1] "github_error"   "http_error_401" "error"          "condition"     

$pids
 [1] 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242 1242
[20] 1242 1242 1242 1242 1242

attr(,"class")
[1] "rlib_trace"

Here is my session

devtools::session_info()
─ Session info ────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       macOS Big Sur 11.6          
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_CA.UTF-8                 
 ctype    en_CA.UTF-8                 
 tz       America/Recife              
 date     2021-11-25     

rfishbase          * 3.1.8      2021-06-07 [1] CRAN (R 4.1.0)  
cboettig commented 2 years ago

Thanks, can you please upgrade to the current CRAN version of rfishbase (3.1.10) and try again?
(Note this issue has been reported before, e.g. #218, #216, sometimes those earlier closed issues with similar descriptions can be helpful).

jepa commented 2 years ago

Thanks for your help