rOpenGov / pxweb

R tools to access PX-WEB API
http://ropengov.github.io/pxweb
Other
69 stars 31 forks source link

pxweb_interactive gives Error: Incorrect return response from PXWEB API url #230

Closed emilwest closed 2 years ago

emilwest commented 3 years ago

Hi,

When using pxweb_interactive() and navigating using the following options:

[ 16 ] : Statistics Norway
[ 1 ] : v0  
[ 1 ] : en 
[ 1 ] : Statbank by subject
[ 18 ] : Transport and tourism
[ 3 ] : Tourism 
[ 3 ] : Accommodation 

I get the following error returned on the last selection (accommodation): Error: Incorrect return response from PXWEB API url: http://data.ssb.no/api/v0/en/table/tr/tr04/overnatting

When retrieving the data like this however, it works as expected:

pxweb_query_list <-
    list("Region"=c("0"),
         "Landkoder2"=c("*"),
         "ContentsCode"=c("Overnattinger"),
         "Tid"=c("*"))

  # Download data
  px_data <-
    pxweb_get(url = "http://data.ssb.no/api/v0/en/table/tr/tr04/overnatting/SBMENU8380/HotellOvernMnd",
              query = pxweb_query_list)

I'm not sure whether it's a problem with SSB or pxweb, in any case I would be happy to know more about the error!

My specs: R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042) pxweb version: 0.11.0

emilwest commented 3 years ago

Here is the entire sessionInfo() in case it's needed:

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

locale:
[1] LC_COLLATE=Swedish_Sweden.1252  LC_CTYPE=Swedish_Sweden.1252   
[3] LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C                   
[5] LC_TIME=Swedish_Sweden.1252    

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

other attached packages:
 [1] zoo_1.8-9          lattice_0.20-45    OECD_0.2.4        
 [4] compare_0.2-6      dkstat_0.08        pxweb_0.11.0      
 [7] lubridate_1.7.10   filesstrings_3.2.2 readxl_1.3.1      
[10] writexl_1.4.0      NSDB_0.1.6         pxR_0.42.4        
[13] RJSONIO_1.3-1.6    reshape2_1.4.4     forcats_0.5.1     
[16] stringr_1.4.0      purrr_0.3.4        readr_2.0.1       
[19] tidyr_1.1.3        tibble_3.1.4       ggplot2_3.3.5     
[22] tidyverse_1.3.1    dplyr_1.0.7        eurostat_3.7.5    
[25] plyr_1.8.6        

loaded via a namespace (and not attached):
 [1] httr_1.4.2         pkgload_1.2.2      bit64_4.0.5       
 [4] vroom_1.5.5        jsonlite_1.7.2     modelr_0.1.8      
 [7] assertthat_0.2.1   countrycode_1.3.0  cellranger_1.1.0  
[10] pillar_1.6.3       backports_1.2.1    glue_1.4.2        
[13] checkmate_2.0.0    rvest_1.0.1        RefManageR_1.3.0  
[16] colorspace_2.0-2   pkgconfig_2.0.3    broom_0.7.9       
[19] haven_2.4.3        scales_1.1.1       openxlsx_4.2.4    
[22] tzdb_0.1.2         proxy_0.4-26       generics_0.1.0    
[25] ellipsis_0.3.2     withr_2.4.2        cli_3.0.1         
[28] magrittr_2.0.1     crayon_1.4.1       strex_1.4.2       
[31] fs_1.5.0           fansi_0.5.0        xml2_1.3.2        
[34] class_7.3-19       tools_4.1.0        hms_1.1.1         
[37] lifecycle_1.0.1    munsell_0.5.0      reprex_2.0.1      
[40] zip_2.2.0          compiler_4.1.0     e1071_1.7-9       
[43] rlang_0.4.11       classInt_0.4-3     units_0.7-2       
[46] grid_4.1.0         rstudioapi_0.13    testthat_3.0.4    
[49] gtable_0.3.0       DBI_1.1.1          curl_4.3.2        
[52] R6_2.5.1           bit_4.0.4          utf8_1.2.2        
[55] rprojroot_2.0.2    desc_1.4.0         KernSmooth_2.23-20
[58] stringi_1.7.4      parallel_4.1.0     Rcpp_1.0.7        
[61] vctrs_0.3.8        sf_1.0-2           dbplyr_2.1.1      
[64] tidyselect_1.1.1  
MansMeg commented 3 years ago

Hi! Thanks for reporting! I need to check this manually. I guess the problem is in SSB, but Im not sure.

MansMeg commented 2 years ago

Now fixed in version 0.12.0. Header objects have now been added to pxweb APIs. Now those are handled as well.

Thanks for reporting this!

emilwest commented 2 years ago

Thanks for fixing!