Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MansMeg committed Jan 28, 2024
1 parent 52fd866 commit bc39c8a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: pxweb
Title: R Interface to PXWEB APIs
Version: 0.16.3
Date: 2024-01-13
Version: 0.17.0
Date: 2024-01-28
Authors@R: c(
person("Mans", "Magnusson", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0296-2719")),
Expand Down Expand Up @@ -35,6 +35,7 @@ Depends:
R (>= 3.5.0)
Imports:
checkmate,
curl,
httr (>= 1.1),
jsonlite
Suggests:
Expand Down
8 changes: 8 additions & 0 deletions R/pxweb.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#'
#' @export
pxweb <- function(url) {
if(!curl::has_internet()){
message(no_internet_msg())
return(NULL)
}
if (is.pxweb(url)) {
return(url)
}
Expand Down Expand Up @@ -119,3 +123,7 @@ pxweb_tempdir <- function(to = "apis") {
return(tmp_dir_logs)
}
}

no_internet_msg <- function(){
return("No internet access.")
}
4 changes: 4 additions & 0 deletions R/pxweb_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ pxweb_get_data <- function(url, query, verbose = TRUE, column.name.type = "text"
#' both \code{httr::POST} and \code{httr::GET}.
#' @export
pxweb_advanced_get <- function(url, query = NULL, verbose = TRUE, log_http_calls = FALSE, pxmdo = NULL, ...) {
if(!curl::has_internet()){
message(no_internet_msg())
return(NULL)
}
checkmate::assert_flag(log_http_calls)
checkmate::assert_class(pxmdo, classes = "pxweb_metadata", null.ok = TRUE)
if (log_http_calls) {
Expand Down
4 changes: 4 additions & 0 deletions R/pxweb_interactive.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#' ## x <- pxweb_interactive(x = "https://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101/BE0101A/")
#'
pxweb_interactive <- function(x = NULL) {
if(!curl::has_internet()){
message(no_internet_msg())
return(NULL)
}
# Setup structure
pxe <- pxweb_explorer(x)

Expand Down

0 comments on commit bc39c8a

Please sign in to comment.