ABbiodiversity / wildrtrax

This is an R package that enables environmental sensor users to create comprehensive work flows for managing and analyzing data
https://abbiodiversity.github.io/wildrtrax/
Other
10 stars 9 forks source link

Authentication failure while properly authentified within package #59

Closed VLucet closed 3 months ago

VLucet commented 4 months ago

Hello,

For some reason, I am getting HTTP 500 errors where I used to have no issues. I properly authentify with wt_auth and then attempt a download, but get an error.

> wt_auth(force = T)
Authentication into WildTrax successful.

Using demo project as an example:

> wt_download_report(project_id = 220, sensor_id = 'CAM',
+                    reports = "project", weather_cols = F)
Downloading: 120 B     Error: Authentication failed [500]

Only the "main" report seems to work.

> wt_download_report(project_id = 220, sensor_id = 'CAM',
+                    reports = "main", weather_cols = F)
# A tibble: 28,664 × 35 
My session info: ``` > sessionInfo() R version 4.4.0 (2024-04-24) Platform: x86_64-pc-linux-gnu Running under: Pop!_OS 22.04 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 locale: [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8 [4] LC_COLLATE=en_CA.UTF-8 LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8 [7] LC_PAPER=en_CA.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C time zone: America/Toronto tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices datasets utils methods base other attached packages: [1] wildRtrax_1.2.0 tidyr_1.3.1 dplyr_1.1.4 tibble_3.2.1 tarchetypes_0.9.0 [6] targets_1.7.0 loaded via a namespace (and not attached): [1] gtable_0.3.5 xfun_0.44 ggplot2_3.5.1 processx_3.8.4 [5] lattice_0.22-6 callr_3.7.6 tzdb_0.4.0 vctrs_0.6.5 [9] tools_4.4.0 ps_1.7.6 generics_0.1.3 curl_5.2.1 [13] base64url_1.4 parallel_4.4.0 proxy_0.4-27 fansi_1.0.6 [17] pkgconfig_2.0.3 KernSmooth_2.23-24 data.table_1.15.4 secretbase_0.5.0 [21] tuneR_1.4.7 lifecycle_1.0.4 stringr_1.5.1 compiler_4.4.0 [25] munsell_0.5.1 terra_1.7-78 codetools_0.2-20 class_7.3-22 [29] yaml_2.3.8 intrval_0.1-3 pillar_1.9.0 furrr_0.3.1 [33] MASS_7.3-61 classInt_0.4-10 magick_2.8.3 parallelly_1.37.1 [37] QPAD_0.0-3 tidyselect_1.2.1 digest_0.6.35 stringi_1.8.4 [41] future_1.33.2 sf_1.0-16 purrr_1.0.2 listenv_0.9.1 [45] grid_4.4.0 colorspace_2.1-0 cli_3.6.2 magrittr_2.0.3 [49] utf8_1.2.4 e1071_1.7-14 readr_2.1.5 withr_3.0.0 [53] scales_1.3.0 backports_1.5.0 unmarked_1.4.1 lubridate_1.9.3 [57] timechange_0.3.0 httr_1.4.7 globals_0.16.3 signal_1.8-0 [61] igraph_2.0.3 progressr_0.14.0 hms_1.1.3 knitr_1.47 [65] markdown_1.13 rlang_1.1.4 Rcpp_1.0.12 DBI_1.2.3 [69] glue_1.7.0 seewave_2.2.3 pipeR_0.6.1.3 renv_1.0.7 [73] jsonlite_1.8.8 R6_2.5.1 units_0.8-5 fs_1.6.4 ```
alexmacphail commented 3 months ago

Thanks @VLucet , this was on the WildTrax API side but has been fixed

library(testthat)
suppressWarnings(library(wildRtrax))

Sys.setenv(WT_USERNAME = "guest", WT_PASSWORD = "Apple123")
wt_auth(force = TRUE)
#> Authentication into WildTrax successful.

test_that("Downloading CAM report for ABMI Amphibian project", {
  abmi_amph_cam <- wt_download_report(391, 'CAM', c('project'), FALSE)
  expect_true(!is.null(abmi_amph_cam))
})
#>  Downloading: 46 kB     Test passed 🎉

Created on 2024-07-09 with reprex v2.1.0

VLucet commented 3 months ago

Thanks!