ropensci/rcrossref

agency not found - proceeding with 'crossref' ...

towitter opened this issue · 6 comments

Hi there,
I am repeatedly getting the warning 'agency not found' (see referenced issue that was closed before). I am posting below my output from the command @sckott suggested back then. Maybe it helps to clarify why that warning appears?
Thanks in advance!

I'm not getting those warnings. Can you replicate that this is still happening? if so, can you run

cr_agency(dois="10.1126/science.169.3946.635", verbose = TRUE)

and see if you get back (the verbose is to print http response headers to see if there's any info in there that might help diagnose)

$DOI
[1] "10.1126/science.169.3946.635"

$agency
$agency$id
[1] "crossref"

$agency$label
[1] "Crossref"

Originally posted by @sckott in #172 (comment)

So, I followed that advice and this is what R returns:

cr_agency(dois="10.1126/science.169.3946.635", verbose = TRUE)

  • Hostname in DNS cache was stale, zapped
  • Trying 208.254.38.72...
  • TCP_NODELAY set
  • Connected to api.crossref.org (208.254.38.72) port 443 (#123)

GET /works/https://doi.org/10.1073/pnas.1915841117/agency HTTP/1.1
Host: api.crossref.org
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, /
User-Agent: r-curl/4.3.2 crul/1.1.0 rOpenSci(rcrossref/1.1.0) (mailto:tobias.witter@wiwi.hu-berlin.de)
X-USER-AGENT: r-curl/4.3.2 crul/1.1.0 rOpenSci(rcrossref/1.1.0) (mailto:tobias.witter@wiwi.hu-berlin.de)

< HTTP/1.1 404 Not Found
< date: Wed, 26 Jan 2022 09:32:08 GMT
< content-type: application/json;charset=utf-8
< transfer-encoding: chunked

  • Added cookie AWSALB="34c90LckFuxHgOne/zBeQcZ6HU2l977OVJGFCA430fkLi4cR4PQZjOLdygG6DoVM3mL2UmvbSVE0GNflGqHJz8B2qF3O7YKuA6l4Ptc1w9/a6UcVKydqB+IB9Mqs" for domain api.crossref.org, path /, expire 1643794328
    < set-cookie: AWSALB=34c90LckFuxHgOne/zBeQcZ6HU2l977OVJGFCA430fkLi4cR4PQZjOLdygG6DoVM3mL2UmvbSVE0GNflGqHJz8B2qF3O7YKuA6l4Ptc1w9/a6UcVKydqB+IB9Mqs; Expires=Wed, 02 Feb 2022 09:32:08 GMT; Path=/
  • Added cookie AWSALBCORS="34c90LckFuxHgOne/zBeQcZ6HU2l977OVJGFCA430fkLi4cR4PQZjOLdygG6DoVM3mL2UmvbSVE0GNflGqHJz8B2qF3O7YKuA6l4Ptc1w9/a6UcVKydqB+IB9Mqs" for domain api.crossref.org, path /, expire 1643794328
    < set-cookie: AWSALBCORS=34c90LckFuxHgOne/zBeQcZ6HU2l977OVJGFCA430fkLi4cR4PQZjOLdygG6DoVM3mL2UmvbSVE0GNflGqHJz8B2qF3O7YKuA6l4Ptc1w9/a6UcVKydqB+IB9Mqs; Expires=Wed, 02 Feb 2022 09:32:08 GMT; Path=/; SameSite=None
    < vary: Accept
    < access-control-expose-headers: Link
    < access-control-allow-headers: X-Requested-With, Accept, Accept-Encoding, Accept-Charset, Accept-Language, Accept-Ranges, Cache-Control
    < access-control-allow-origin: *
    < server: Jetty(9.4.40.v20210413)
    < x-ratelimit-limit: 50
    < x-ratelimit-interval: 1s
    < x-api-pool: polite
    < x-rate-limit-limit: 50
    < x-rate-limit-interval: 1s
    < permissions-policy: interest-cohort=()
    < connection: close
    <
  • Closing connection 123
  • schannel: shutting down SSL/TLS connection with api.crossref.org port 443
  • Hostname api.crossref.org was found in DNS cache
  • Trying 208.254.38.72...
  • TCP_NODELAY set
  • Connected to api.crossref.org (208.254.38.72) port 443 (#124)

GET /works/10.1126/science.169.3946.635/agency HTTP/1.1
Host: api.crossref.org
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, /
User-Agent: r-curl/4.3.2 crul/1.1.0 rOpenSci(rcrossref/1.1.0) (mailto:tobias.witter@wiwi.hu-berlin.de)
X-USER-AGENT: r-curl/4.3.2 crul/1.1.0 rOpenSci(rcrossref/1.1.0) (mailto:tobias.witter@wiwi.hu-berlin.de)

< HTTP/1.1 200 OK
< date: Wed, 26 Jan 2022 09:32:32 GMT
< content-type: application/json;charset=utf-8
< transfer-encoding: chunked

  • Added cookie AWSALB="YZw30TA8Ebidd3miPPbJ/PVXaONmAFtuHM70bWuxRLxORHkDcKCEbQOtswTFSo6ryBXUs3Xh/shOgohcqcgwgzGmgXMO1RotpE+iSIMXQReaWzXLiRPpkJyK6tYM" for domain api.crossref.org, path /, expire 1643794352
    < set-cookie: AWSALB=YZw30TA8Ebidd3miPPbJ/PVXaONmAFtuHM70bWuxRLxORHkDcKCEbQOtswTFSo6ryBXUs3Xh/shOgohcqcgwgzGmgXMO1RotpE+iSIMXQReaWzXLiRPpkJyK6tYM; Expires=Wed, 02 Feb 2022 09:32:32 GMT; Path=/
  • Added cookie AWSALBCORS="YZw30TA8Ebidd3miPPbJ/PVXaONmAFtuHM70bWuxRLxORHkDcKCEbQOtswTFSo6ryBXUs3Xh/shOgohcqcgwgzGmgXMO1RotpE+iSIMXQReaWzXLiRPpkJyK6tYM" for domain api.crossref.org, path /, expire 1643794352
    < set-cookie: AWSALBCORS=YZw30TA8Ebidd3miPPbJ/PVXaONmAFtuHM70bWuxRLxORHkDcKCEbQOtswTFSo6ryBXUs3Xh/shOgohcqcgwgzGmgXMO1RotpE+iSIMXQReaWzXLiRPpkJyK6tYM; Expires=Wed, 02 Feb 2022 09:32:32 GMT; Path=/; SameSite=None
    < vary: Accept
    < access-control-expose-headers: Link
    < access-control-allow-headers: X-Requested-With, Accept, Accept-Encoding, Accept-Charset, Accept-Language, Accept-Ranges, Cache-Control
    < access-control-allow-origin: *
    < server: Jetty(9.4.40.v20210413)
    < x-ratelimit-limit: 50
    < x-ratelimit-interval: 1s
    < x-api-pool: polite
    < x-rate-limit-limit: 50
    < x-rate-limit-interval: 1s
    < permissions-policy: interest-cohort=()
    < connection: close
    <
  • Closing connection 124
  • schannel: shutting down SSL/TLS connectError in cr_GET(endpoint = sprintf("works/%s/agency", x), args = list(), :
    res$response_headers$content-type == "application/json;charset=UTF-8" ist nicht TRUE

Hi @towitter

Can you provide me with your session info, especially which rcrossref version you are using. Here's my reprex

library(rcrossref)
library(sessioninfo)

cr_cn("10.1126/science.169.3946.635")
#> [1] "@article{Frank_1970,\n\tdoi = {10.1126/science.169.3946.635},\n\turl = {https://doi.org/10.1126%2Fscience.169.3946.635},\n\tyear = 1970,\n\tmonth = {aug},\n\tpublisher = {American Association for the Advancement of Science ({AAAS})},\n\tvolume = {169},\n\tnumber = {3946},\n\tpages = {635--641},\n\tauthor = {Henry S. Frank},\n\ttitle = {The Structure of Ordinary Water},\n\tjournal = {Science}\n}"

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.1.2 (2021-11-01)
#>  os       macOS Big Sur 11.4          
#>  system   aarch64, darwin20           
#>  ui       X11                         
#>  language en                          
#>  collate  de_DE.UTF-8                 
#>  ctype    de_DE.UTF-8                 
#>  tz       Europe/Copenhagen           
#>  date     2022-01-26                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version  date       lib source                             
#>  assertthat    0.2.1    2019-03-21 [1] CRAN (R 4.1.0)                     
#>  backports     1.2.1    2020-12-09 [1] CRAN (R 4.1.0)                     
#>  cli           3.1.0    2021-10-27 [1] CRAN (R 4.1.1)                     
#>  crayon        1.4.2    2021-10-29 [1] CRAN (R 4.1.1)                     
#>  crul          1.1.0    2021-02-15 [1] CRAN (R 4.1.0)                     
#>  curl          4.3.2    2021-06-23 [1] CRAN (R 4.1.0)                     
#>  DBI           1.1.1    2021-01-15 [1] CRAN (R 4.1.0)                     
#>  digest        0.6.28   2021-09-23 [1] CRAN (R 4.1.1)                     
#>  dplyr         1.0.7    2021-06-18 [1] CRAN (R 4.1.0)                     
#>  DT            0.19     2021-09-02 [1] CRAN (R 4.1.1)                     
#>  ellipsis      0.3.2    2021-04-29 [1] CRAN (R 4.1.0)                     
#>  evaluate      0.14     2019-05-28 [1] CRAN (R 4.1.0)                     
#>  fansi         0.5.0    2021-05-25 [1] CRAN (R 4.1.0)                     
#>  fastmap       1.1.0    2021-01-25 [1] CRAN (R 4.1.0)                     
#>  fs            1.5.0    2020-07-31 [1] CRAN (R 4.1.0)                     
#>  generics      0.1.1    2021-10-25 [1] CRAN (R 4.1.1)                     
#>  glue          1.4.2    2020-08-27 [1] CRAN (R 4.1.0)                     
#>  highr         0.9      2021-04-16 [1] CRAN (R 4.1.0)                     
#>  htmltools     0.5.2    2021-08-25 [1] CRAN (R 4.1.1)                     
#>  htmlwidgets   1.5.4    2021-09-08 [1] CRAN (R 4.1.1)                     
#>  httpcode      0.3.0    2020-04-10 [1] CRAN (R 4.1.0)                     
#>  httpuv        1.6.3    2021-09-09 [1] CRAN (R 4.1.1)                     
#>  jsonlite      1.7.2    2020-12-09 [1] CRAN (R 4.1.0)                     
#>  knitr         1.37     2021-12-16 [1] CRAN (R 4.1.1)                     
#>  later         1.3.0    2021-08-18 [1] CRAN (R 4.1.1)                     
#>  lifecycle     1.0.1    2021-09-24 [1] CRAN (R 4.1.1)                     
#>  magrittr      2.0.1    2020-11-17 [1] CRAN (R 4.1.0)                     
#>  mime          0.12     2021-09-28 [1] CRAN (R 4.1.1)                     
#>  miniUI        0.1.1.1  2018-05-18 [1] CRAN (R 4.1.0)                     
#>  pillar        1.6.4    2021-10-18 [1] CRAN (R 4.1.0)                     
#>  pkgconfig     2.0.3    2019-09-22 [1] CRAN (R 4.1.0)                     
#>  plyr          1.8.6    2020-03-03 [1] CRAN (R 4.1.0)                     
#>  promises      1.2.0.1  2021-02-11 [1] CRAN (R 4.1.0)                     
#>  purrr         0.3.4    2020-04-17 [1] CRAN (R 4.1.0)                     
#>  R6            2.5.1    2021-08-19 [1] CRAN (R 4.1.1)                     
#>  Rcpp          1.0.7    2021-07-07 [1] CRAN (R 4.1.0)                     
#>  rcrossref   * 1.1.0.99 2021-10-16 [1] Github (ropensci/rcrossref@319f34c)
#>  reprex        2.0.0    2021-04-02 [1] CRAN (R 4.1.0)                     
#>  rlang         0.4.12   2021-10-18 [1] CRAN (R 4.1.0)                     
#>  rmarkdown     2.11     2021-09-14 [1] CRAN (R 4.1.1)                     
#>  sessioninfo * 1.1.1    2018-11-05 [1] CRAN (R 4.1.0)                     
#>  shiny         1.7.1    2021-10-02 [1] CRAN (R 4.1.1)                     
#>  stringi       1.7.5    2021-10-04 [1] CRAN (R 4.1.1)                     
#>  stringr       1.4.0    2019-02-10 [1] CRAN (R 4.1.0)                     
#>  styler        1.5.1    2021-07-13 [1] CRAN (R 4.1.0)                     
#>  tibble        3.1.5    2021-09-30 [1] CRAN (R 4.1.1)                     
#>  tidyselect    1.1.1    2021-04-30 [1] CRAN (R 4.1.0)                     
#>  triebeard     0.3.0    2016-08-04 [1] CRAN (R 4.1.0)                     
#>  urltools      1.7.3    2019-04-14 [1] CRAN (R 4.1.0)                     
#>  utf8          1.2.2    2021-07-24 [1] CRAN (R 4.1.0)                     
#>  vctrs         0.3.8    2021-04-29 [1] CRAN (R 4.1.0)                     
#>  withr         2.4.2    2021-04-18 [1] CRAN (R 4.1.0)                     
#>  xfun          0.29     2021-12-14 [1] CRAN (R 4.1.1)                     
#>  xml2          1.3.2    2020-04-23 [1] CRAN (R 4.1.0)                     
#>  xtable        1.8-4    2019-04-21 [1] CRAN (R 4.1.0)                     
#>  yaml          2.2.1    2020-02-01 [1] CRAN (R 4.1.0)                     
#> 
#> [1] /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library

Created on 2022-01-26 by the reprex package (v2.0.0)

Here you go @njahn82

> library(rcrossref)
> library(sessioninfo)
> 
> cr_cn("10.1126/science.169.3946.635")
Error in cr_GET(endpoint = sprintf("works/%s/agency", x), args = list(),  : 
  res$response_headers$`content-type` == "application/json;charset=UTF-8" ist nicht TRUE
> session_info()
- Session info ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  German_Germany.1252         
 ctype    German_Germany.1252         
 tz       Europe/Berlin               
 date     2022-01-26                  

- Packages --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.1.0)
 backports     1.2.1   2020-12-09 [1] CRAN (R 4.1.0)
 bit           4.0.4   2020-08-04 [1] CRAN (R 4.1.0)
 bit64         4.0.5   2020-08-30 [1] CRAN (R 4.1.0)
 blob          1.2.1   2020-01-20 [1] CRAN (R 4.1.0)
 broom         0.7.9   2021-07-27 [1] CRAN (R 4.1.1)
 cellranger    1.1.0   2016-07-27 [1] CRAN (R 4.1.0)
 cli           3.0.0   2021-06-30 [1] CRAN (R 4.1.0)
 colorspace    2.0-2   2021-06-24 [1] CRAN (R 4.1.0)
 crayon        1.4.1   2021-02-08 [1] CRAN (R 4.1.0)
 crul          1.1.0   2021-02-15 [1] CRAN (R 4.1.0)
 curl          4.3.2   2021-06-23 [1] CRAN (R 4.1.0)
 data.table  * 1.14.0  2021-02-21 [1] CRAN (R 4.1.0)
 DBI           1.1.1   2021-01-15 [1] CRAN (R 4.1.0)
 dbplyr        2.1.1   2021-04-06 [1] CRAN (R 4.1.0)
 digest        0.6.28  2021-09-23 [1] CRAN (R 4.1.1)
 dplyr       * 1.0.7   2021-06-18 [1] CRAN (R 4.1.0)
 DT            0.18    2021-04-14 [1] CRAN (R 4.1.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.1.0)
 fansi         0.5.0   2021-05-25 [1] CRAN (R 4.1.0)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.1.0)
 forcats     * 0.5.1   2021-01-27 [1] CRAN (R 4.1.0)
 fs            1.5.0   2020-07-31 [1] CRAN (R 4.1.0)
 generics      0.1.0   2020-10-31 [1] CRAN (R 4.1.0)
 ggplot2     * 3.3.5   2021-06-25 [1] CRAN (R 4.1.0)
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.1.0)
 gtable        0.3.0   2019-03-25 [1] CRAN (R 4.1.0)
 haven         2.4.1   2021-04-23 [1] CRAN (R 4.1.0)
 hms           1.1.1   2021-09-26 [1] CRAN (R 4.1.1)
 htmltools     0.5.2   2021-08-25 [1] CRAN (R 4.1.1)
 htmlwidgets   1.5.4   2021-09-08 [1] CRAN (R 4.1.1)
 httpcode      0.3.0   2020-04-10 [1] CRAN (R 4.1.0)
 httpuv        1.6.3   2021-09-09 [1] CRAN (R 4.1.1)
 httr          1.4.2   2020-07-20 [1] CRAN (R 4.1.0)
 jsonlite      1.7.2   2020-12-09 [1] CRAN (R 4.1.0)
 later         1.3.0   2021-08-18 [1] CRAN (R 4.1.1)
 lifecycle     1.0.1   2021-09-24 [1] CRAN (R 4.1.1)
 lubridate     1.7.10  2021-02-26 [1] CRAN (R 4.1.0)
 magrittr    * 2.0.1   2020-11-17 [1] CRAN (R 4.1.0)
 mime          0.12    2021-09-28 [1] CRAN (R 4.1.1)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.1.0)
 modelr        0.1.8   2020-05-19 [1] CRAN (R 4.1.0)
 munsell       0.5.0   2018-06-12 [1] CRAN (R 4.1.0)
 pillar        1.6.3   2021-09-26 [1] CRAN (R 4.1.1)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.1.0)
 plyr          1.8.6   2020-03-03 [1] CRAN (R 4.1.0)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.1.0)
 purrr       * 0.3.4   2020-04-17 [1] CRAN (R 4.1.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.1.1)
 Rcpp          1.0.7   2021-07-07 [1] CRAN (R 4.1.0)
 rcrossref   * 1.1.0   2020-10-02 [1] CRAN (R 4.1.2)
 readr       * 2.0.2   2021-09-27 [1] CRAN (R 4.1.1)
 readxl        1.3.1   2019-03-13 [1] CRAN (R 4.1.0)
 reprex        2.0.0   2021-04-02 [1] CRAN (R 4.1.0)
 rjson         0.2.21  2022-01-09 [1] CRAN (R 4.1.2)
 rlang         0.4.11  2021-04-30 [1] CRAN (R 4.1.0)
 RPostgres   * 1.3.3   2021-07-05 [1] CRAN (R 4.1.0)
 rscopus     * 0.6.6   2019-09-17 [1] CRAN (R 4.1.0)
 rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.1.0)
 rvest         1.0.1   2021-07-26 [1] CRAN (R 4.1.1)
 scales        1.1.1   2020-05-11 [1] CRAN (R 4.1.0)
 sessioninfo * 1.1.1   2018-11-05 [1] CRAN (R 4.1.0)
 shiny         1.7.1   2021-10-02 [1] CRAN (R 4.1.1)
 stringi       1.7.5   2021-10-04 [1] CRAN (R 4.1.1)
 stringr     * 1.4.0   2019-02-10 [1] CRAN (R 4.1.0)
 tibble      * 3.1.5   2021-09-30 [1] CRAN (R 4.1.1)
 tidyr       * 1.1.4   2021-09-27 [1] CRAN (R 4.1.1)
 tidyselect    1.1.1   2021-04-30 [1] CRAN (R 4.1.0)
 tidyverse   * 1.3.1   2021-04-15 [1] CRAN (R 4.1.0)
 triebeard     0.3.0   2016-08-04 [1] CRAN (R 4.1.0)
 tzdb          0.1.2   2021-07-20 [1] CRAN (R 4.1.1)
 urltools      1.7.3   2019-04-14 [1] CRAN (R 4.1.0)
 utf8          1.2.2   2021-07-24 [1] CRAN (R 4.1.1)
 vctrs         0.3.8   2021-04-29 [1] CRAN (R 4.1.0)
 withr         2.4.2   2021-04-18 [1] CRAN (R 4.1.0)
 xml2          1.3.2   2020-04-23 [1] CRAN (R 4.1.0)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.1.0)

[1] /R/win-library/4.1
[2] /R-4.1.0/library

Please re-install rcrossref using the dev version.

remotes::install_github("ropensci/rcrossref")

CRAN version has not been updated yet.

Ok, I did. Unfortunately, the warning still return, even with rcrossref * 1.1.0.99 2021-10-16 [1] Github (319f34c).

rcrossref::cr_cn("https://doi.org/10.1073/pnas.1915841117", 'text')
[1] "Agrawal, M., Peterson, J. C., & Griffiths, T. L. (2020). Scaling up psychology via Scientific Regret Minimization. Proceedings of the National Academy of Sciences, 117(16), 8825–8835. doi:10.1073/pnas.1915841117"
Warning message:
https://doi.org/10.1073/pnas.1915841117 agency not found - proceeding with 'crossref' ...

I think the issue is that the API does not support DOI links, but just DOIs. Please call cr_cn using DOIs only to avoid the warning.

# DOI link
rcrossref::cr_cn('https://doi.org/10.1073/pnas.1915841117', 'text')
#> Warning: https://doi.org/10.1073/pnas.1915841117 agency not found - proceeding
#> with 'crossref' ...
#> [1] "Agrawal, M., Peterson, J. C., & Griffiths, T. L. (2020). Scaling up psychology via Scientific Regret Minimization. Proceedings of the National Academy of Sciences, 117(16), 8825–8835. doi:10.1073/pnas.1915841117"
# DOI
rcrossref::cr_cn('10.1073/pnas.1915841117', 'text')
#> [1] "Agrawal, M., Peterson, J. C., & Griffiths, T. L. (2020). Scaling up psychology via Scientific Regret Minimization. Proceedings of the National Academy of Sciences, 117(16), 8825–8835. doi:10.1073/pnas.1915841117"

Created on 2022-01-27 by the reprex package (v2.0.0)

That solved the issue - thank you so much!