ropensci / traits

R package for accessing species trait data from multiple databases
Other
39 stars 14 forks source link

Unauthorized (HTTP 401) in betydb_query #118

Closed serbinsh closed 3 years ago

serbinsh commented 4 years ago
Session Info ```r betydb_search(query = "Maple SLA", include_unchecked = NULL, progress = TRUE) ``` Gives the expected results ``` # A tibble: 27 x 36 checked result_type id citation_id site_id treatment_id sitename city lat lon scientificname commonname genus 1 1 traits 37562 381 602 1220 NA NA NA NA Acer rubrum red maple Acer 2 1 traits 37563 381 602 1220 NA NA NA NA Acer sacchari… silver ma… Acer 3 1 traits 37583 381 602 1220 NA NA NA NA Acer rubrum red maple Acer 4 1 traits 37584 381 602 1220 NA NA NA NA Acer sacchari… silver ma… Acer 5 1 traits 37604 381 602 1220 NA NA NA NA Acer rubrum red maple Acer 6 1 traits 37605 381 602 1220 NA NA NA NA Acer sacchari… silver ma… Acer 7 1 traits 25319 51 NA 1 NA NA NA NA Flindersia br… Queenslan… Flin… 8 1 traits 25481 51 NA 1 NA NA NA NA Flindersia br… Queenslan… Flin… 9 1 traits 37379 398 609 1254 Harvard… Bedf… 42.1 -72.0 Acer rubrum red maple Acer 10 1 traits 37384 398 609 1253 Harvard… Bedf… 42.1 -72.0 Acer rubrum red maple Acer # … with 17 more rows, and 23 more variables: species_id , cultivar_id , author , citation_year , # treatment , date , time , raw_date , month , year , dateloc , trait , # trait_description , mean , units , n , statname , stat , notes , access_level , # cultivar , entity , method_name ``` BUT if I try ```r betydb_query(genus = "Miscanthus", table = "species") %>% nrow() ``` I get ``` Error in betydb_http(url, args, key, user, pwd, ...) : Unauthorized (HTTP 401). ```

I am getting

Error in betydb_http(url, args, key, user, pwd, ...) : 
  Unauthorized (HTTP 401).

When I try to query betyDB? See session info above. Why does betydb_search work and betydb_query doesnt? Am I missing something?

sckott commented 4 years ago

thanks for the issue @serbinsh - can you include your session info please

serbinsh commented 4 years ago

Sure. Sorry put the details in the wrong place. Will do when back in my office.

[iphone]

On Feb 27, 2020, at 13:03, Scott Chamberlain notifications@github.com wrote:



thanks for the issue @serbinshhttps://github.com/serbinsh - can you include your session info please

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ropensci/traits/issues/118?email_source=notifications&email_token=AAXM32L3UDXY464XZUZP2HDRE757BA5CNFSM4K47XQ3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENFK3TY#issuecomment-592096719, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAXM32KN5MKSAMIZLVKS6IDRE757BANCNFSM4K47XQ3A.

serbinsh commented 4 years ago

@sckott is this what you were looking for?

sessionInfo(package = NULL)
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] devtools_2.2.1    usethis_1.5.1     dplyr_0.8.4       traits_0.4.2.9100

loaded via a namespace (and not attached):
 [1] tidyselect_1.0.0  zoo_1.8-7         remotes_2.1.0     purrr_0.3.3       taxize_0.9.92.91  lattice_0.20-38   vctrs_0.2.3      
 [8] testthat_2.3.1    utf8_1.1.4        rlang_0.4.4       pkgbuild_1.0.6    pillar_1.4.3      httpcode_0.2.0    glue_1.3.1       
[15] withr_2.1.2       rappdirs_0.3.1    sessioninfo_1.1.1 foreach_1.4.8     plyr_1.8.5        stringr_1.4.0     rvest_0.3.5      
[22] codetools_0.2-16  memoise_1.1.0     callr_3.4.1       ps_1.3.0          curl_4.3          parallel_3.6.2    hoardr_0.5.2     
[29] fansi_0.4.1       Rcpp_1.0.3        readr_1.3.1       backports_1.1.5   desc_1.2.0        pkgload_1.0.2     jsonlite_1.6.1   
[36] fs_1.3.1          hms_0.5.3         digest_0.6.25     stringi_1.4.6     processx_3.4.1    rprojroot_1.3-2   grid_3.6.2       
[43] cli_2.0.1         tools_3.6.2       magrittr_1.5      tibble_2.1.3      bold_0.9.0        crul_0.9.0        crayon_1.3.4     
[50] ape_5.3           pkgconfig_2.0.3   ellipsis_0.3.0    data.table_1.12.8 xml2_1.2.2        prettyunits_1.1.1 assertthat_0.2.1 
[57] reshape_0.8.8     httr_1.4.1        rstudioapi_0.10   iterators_1.0.12  R6_2.4.1          nlme_3.1-143      compiler_3.6.2
sckott commented 4 years ago

@dlebauer any ideas about the problem above?

dlebauer commented 4 years ago

I've tried the following on another instance and it works:

options(betydb_url = "https://terraref.org/bety/",
         betydb_api_version = 'v1')
betydb_query(genus = "Sorghum", table = "species") 

whereas

options(betydb_url = "https://www.betydb.org/",
         betydb_api_version = 'v1')
betydb_query(genus = "Sorghum", table = "species") 

gives the reported error.

Maybe @robkooper will have some insight?