Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 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.17.1
Date: 2025-04-01
Version: 0.17.2
Date: 2025-12-04
Authors@R: c(
person("Mans", "Magnusson", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0296-2719")),
Expand All @@ -16,8 +16,10 @@ Authors@R: c(
person("Thomas", "Runarsson", role = "ctb"),
person("Torbjörn", "Lindquist", role = "ctb"),
person("Palmar", "Thorsteinsson", role = "ctb"),
person("Pyry", "Kantanen", role = "ctb"),
person("Sebastian", "Ankargren", role = "ctb")
person("Pyry", "Kantanen", role = "ctb",
comment = c(ORCID = "0000-0003-2853-2765")),
person("Sebastian", "Ankargren", role = "ctb"),
person("Sampo", "Vesanen", role = "ctb")
)
Description: Generic interface for the PX-Web/PC-Axis API. The
PX-Web/PC-Axis API is used by organizations such as Statistics Sweden
Expand Down Expand Up @@ -49,6 +51,6 @@ Suggests:
VignetteBuilder:
knitr
Encoding: UTF-8
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
X-schema.org-isPartOf: http://ropengov.org/
X-schema.org-keywords: ropengov
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Version 0.17.2

- Fix "Too Many Requests (RFC 6585) (HTTP 429)" error when downloading large queries (issue #281, PR #284 by @sampoves)

# Version 0.17.1

- Enable the use of json-query files downloaded from StatFin website that are wrapped in an additional queryObj-layer. The example json query files used by the package do not have this. (PR #280 by @pitkant)

# Version 0.16.2

- Return better error messages when using as.data.frame() for pxweb metadata objects.
Expand Down
15 changes: 14 additions & 1 deletion R/pxweb_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,20 @@ pxweb_advanced_get <- function(url, query = NULL, verbose = TRUE, log_http_calls
px <- pxweb_add_call(px)
pxurl <- build_pxweb_url(px)
pxqs[[i]] <- pxweb_remove_metadata_from_query(pxqs[[i]], pxmd)
r <- httr::POST(pxurl, body = pxweb_as_json(x = pxqs[[i]]), pxweb_user_agent(), ...)
r <- httr::RETRY(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to move the times, pa_use etc out as an argument through ellipsis and not hardcode it? Or?

verb = "POST",
url = pxurl,
body = pxweb_as_json(x = pxqs[[i]]),
times = 5,
pause_base = 2,
pause_cap = 30,
pause_min = 1,
terminate_on = c(400, 401, 403),
quiet = !verbose,
httr::add_headers(`Content-Type` = "application/json"),
pxweb_user_agent(),
...
)
pxweb_http_log_response(r)
httr::stop_for_status(r)
pxr[[i]] <- pxweb_parse_response(x = r)
Expand Down
2 changes: 0 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pkg <- meta$Package
title <- gsub("'", "", meta$Title)
doi <- paste0("10.32614/CRAN.package.", pkg)

citHeader("Kindly cite the pxweb R package as follows:")

bibentry(bibtype="Manual",
header = sprintf("Kindly cite the '%s' R package as follows:", pkg),
title = sprintf("{%s: %s}", pkg, title),
Expand Down
3 changes: 2 additions & 1 deletion man/pxweb-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.