ropensci / rcrossref

R client for various CrossRef APIs
https://docs.ropensci.org/rcrossref
Other
165 stars 21 forks source link

simple functions not working today. CR API change related? #218

Closed rossmounce closed 1 year ago

rossmounce commented 2 years ago

I haven't played with rcrossref for a while but it just doesn't seem to be working for me. Perhaps related to #216 ? Or the major upgrade to R 4.1.0?

> cr_members(query = 'ecology', limit = 5)
Error in cr_GET(endpoint = path, args, FALSE, parse = TRUE, ...) : 
  res$response_headers$`content-type` == "application/json;charset=UTF-8" is not TRUE
> cr_prefixes(prefixes = c('10.1016','10.1371','10.1023','10.4176','10.1093'))
Error in cr_GET(path, args, todf = FALSE, ...) : 
  res$response_headers$`content-type` == "application/json;charset=UTF-8" is not TRUE
> 
Session Info ```r R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042) Matrix products: default Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rcrossref_1.1.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.7 compiler_4.1.0 pillar_1.6.1 later_1.2.0 [5] plyr_1.8.6 tools_4.1.0 digest_0.6.27 jsonlite_1.7.2 [9] lifecycle_1.0.0 tibble_3.1.2 pkgconfig_2.0.3 rlang_0.4.11 [13] shiny_1.6.0 crul_1.1.0 curl_4.3.2 fastmap_1.1.0 [17] xml2_1.3.2 dplyr_1.0.7 stringr_1.4.0 generics_0.1.0 [21] vctrs_0.3.8 htmlwidgets_1.5.3 triebeard_0.3.0 DT_0.18 [25] tidyselect_1.1.1 glue_1.4.2 httpcode_0.3.0 R6_2.5.0 [29] fansi_0.5.0 purrr_0.3.4 magrittr_2.0.1 urltools_1.7.3 [33] promises_1.2.0.1 ellipsis_0.3.2 htmltools_0.5.1.1 mime_0.11 [37] xtable_1.8-4 httpuv_1.6.1 utf8_1.2.1 stringi_1.6.2 [41] miniUI_0.1.1.1 crayon_1.4.1 ```
sckott commented 2 years ago

may have been a temporary issue. is it still happening now? i can't replicate it

njahn82 commented 2 years ago

it is related to #216 and changes have become effective today for people not using the Polite or Metadata Plus pool. @rossmounce add your email address and then your request should be handled by the polite pool.

https://github.com/ropensci/rcrossref#register-for-the-polite-pool

rossmounce commented 2 years ago

@njahn82 thank you! I will register for the polite pool.

...and yes that fixed the problem for me. Thanks!

bmkramer commented 2 years ago

The polite pool will transition to the new API version on August 3 (https://www.crossref.org/blog/behind-the-scenes-improvements-to-the-rest-api/) so the issue might re-occur then...

It appears that currently in the API response, headers$content-type is application/json;charset=UTF-8 when using the polite pool, but changed to application/json when using the public pool

This is checked for in R/zzz.R in line 45 stopifnot(res$response_headers$content-type== "application/json;charset=UTF-8")

njahn82 commented 2 years ago

{rcrossref} was updated to reflect Crossref's REST API updates for the public and polite pool #216 . Please install the dev version:

remotes::install_github("ropensci/rcrossref")
MrBungle-Codes commented 2 years ago

Hello, I am still having this issue although I registered to the polite pool (email at the .Renviron) and also installed the dev version as indicated. Any help/advice is appreciated. Thanks

Error: Error in cr_GET(endpoint = path, args, todf = FALSE, ...) : res$response_headers$content-type == "application/json;charset=UTF-8" is not TRUE

sessionInfo() R version 4.1.1 (2021-08-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 10 (buster)

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=es_CL.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=es_CL.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=es_CL.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_CL.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] rcrossref_1.1.0 quanteda_3.1.0

loaded via a namespace (and not attached): [1] tidyselect_1.1.1 purrr_0.3.4 lattice_0.20-44 colorspace_2.0-2 vctrs_0.3.8 generics_0.1.0 miniUI_0.1.1.1
[8] htmltools_0.5.2 viridisLite_0.4.0 utf8_1.2.2 plotly_4.9.4.1 rlang_0.4.11 pillar_1.6.2 later_1.3.0
[15] httpcode_0.3.0 glue_1.4.2 DBI_1.1.1 plyr_1.8.6 lifecycle_1.0.0 stringr_1.4.0 munsell_0.5.0
[22] gtable_0.3.0 htmlwidgets_1.5.3 fastmap_1.1.0 httpuv_1.6.2 curl_4.3.2 fansi_0.5.0 triebeard_0.3.0
[29] urltools_1.7.3 Rcpp_1.0.7 xtable_1.8-4 scales_1.1.1 promises_1.2.0.1 DT_0.18 RcppParallel_5.1.4 [36] jsonlite_1.7.2 mime_0.11 fastmatch_1.1-3 stopwords_2.2 ggplot2_3.3.5 digest_0.6.27 stringi_1.7.4
[43] dplyr_1.0.7 shiny_1.6.0 grid_4.1.1 cli_3.0.1 tools_4.1.1 magrittr_2.0.1 lazyeval_0.2.2
[50] tibble_3.1.4 crul_1.1.0 crayon_1.4.1 tidyr_1.1.3 pkgconfig_2.0.3 ellipsis_0.3.2 Matrix_1.3-4
[57] xml2_1.3.2 data.table_1.14.0 assertthat_0.2.1 httr_1.4.2 rstudioapi_0.13 R6_2.5.1 compiler_4.1.1

njahn82 commented 2 years ago

Hi @MrBungle-Codes

please re-install rcrossref using the dev version.

remotes::install_github("ropensci/rcrossref")
MrBungle-Codes commented 2 years ago

thank you very much @njahn82 !!... that solves the issue for me.

Adafede commented 2 years ago

Do we still have to install the dev version from GitHub as a workaround?

njahn82 commented 2 years ago

Yes, please install dev version. Still not updated the version on CRAN

Tom-K-UKRI commented 2 years ago

To note this issue is still occurring and it was solved by installing the dev version (I already had email in Renviron). So presumably still not updated on CRAN

njahn82 commented 1 year ago

The updated version is now available on CRAN, thanks for you patience!