ropensci / taxize

A taxonomic toolbelt for R
https://docs.ropensci.org/taxize
Other
267 stars 60 forks source link

HTTP 404 error for get_tsn() #894

Open rewcook opened 2 years ago

rewcook commented 2 years ago

I'm getting an HTTP 404 error when attempting to get the TSN's from ITIS.

It's only the get_tsn_() function. Other functions (e.g . itis_getrecord) work if I manually add the TSN.


# fails with HTTP 404 error
taxize::get_tsn_('Actitis hypoleucos')

# runs as expected (176613 is Actitis hypoleucos TSN)
taxize::itis_getrecord('176613')
Session Info ```r R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 11.6.2 Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib locale: [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods [7] base loaded via a namespace (and not attached): [1] Rcpp_1.0.9 compiler_4.2.1 pillar_1.7.0 [4] plyr_1.8.7 ritis_1.0.0 iterators_1.0.14 [7] tools_4.2.1 uuid_1.1-0 jsonlite_1.8.0 [10] lifecycle_1.0.1 tibble_3.1.7 nlme_3.1-158 [13] lattice_0.20-45 pkgconfig_2.0.3 rlang_1.0.4 [16] foreach_1.5.2 DBI_1.1.3 cli_3.3.0 [19] rstudioapi_0.13 crul_1.2.0 curl_4.3.2 [22] parallel_4.2.1 stringr_1.4.0 dplyr_1.0.9 [25] xml2_1.3.3 generics_0.1.3 vctrs_0.4.1 [28] triebeard_0.3.0 tidyselect_1.1.2 grid_4.2.1 [31] reshape_0.8.9 glue_1.6.2 httpcode_0.3.0 [34] data.table_1.14.2 R6_2.5.1 fansi_1.0.3 [37] conditionz_0.1.0 solrium_1.2.0 purrr_0.3.4 [40] magrittr_2.0.3 urltools_1.7.3 codetools_0.2-18 [43] ellipsis_0.3.2 assertthat_0.2.1 bold_1.2.0 [46] taxize_0.9.100 ape_5.6-2 utf8_1.2.2 [49] stringi_1.7.8 crayon_1.5.1 zoo_1.8-10 ```
IREdwards27 commented 2 years ago

I'm having the same issue with get_tsn and classification. Classification works if the input is a TSN, but fails with the same 404 error if a taxon name is used. I tested it with Phrurotimpus alarius, Polistes fuscatus, Gorilla gorilla, and Elateridae.

rewcook commented 2 years ago

I know this isn't a 'taxize' solution, and if the package authors would like to remove this work-around please do!

# install.packages('ritis')
# install.packages('tidyverse')

library(tidyverse)

input_vector %>%
    str_replace(., ' ', '\\\\\ ') %>%
    paste0('nameWOInd:', .) %>%
    map_df(., ~ritis::itis_search(q = .))