Skip to content

Commit

Permalink
feat: add package user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
m-muecke committed Dec 10, 2023
1 parent 3635126 commit fddd488
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ importFrom(httr2,req_perform)
importFrom(httr2,req_perform_iterative)
importFrom(httr2,req_url_path_append)
importFrom(httr2,req_url_query)
importFrom(httr2,req_user_agent)
importFrom(httr2,request)
importFrom(httr2,resp_body_json)
importFrom(httr2,resps_data)
2 changes: 2 additions & 0 deletions R/wb.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ worldbank <- function(resource, resp_data, ..., page = NULL) {

worldbank_page <- function(resource, resp_data, ..., page = 1) {
request("http://api.worldbank.org/v2") |>
req_user_agent("worldbank (https://m-muecke.github.io/worldbank)") |>
req_url_path_append(resource) |>
req_url_query(..., format = "json", page = page) |>
req_perform() |>
Expand All @@ -258,6 +259,7 @@ worldbank_page <- function(resource, resp_data, ..., page = 1) {

worldbank_iter <- function(resource, resp_data, ...) {
req <- request("http://api.worldbank.org/v2") |>
req_user_agent("worldbank (https://m-muecke.github.io/worldbank)") |>
req_url_path_append(resource) |>
req_url_query(..., format = "json")

Expand Down
1 change: 1 addition & 0 deletions R/worldbank-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#' @importFrom httr2 req_perform_iterative
#' @importFrom httr2 req_url_path_append
#' @importFrom httr2 req_url_query
#' @importFrom httr2 req_user_agent
#' @importFrom httr2 request
#' @importFrom httr2 resp_body_json
#' @importFrom httr2 resps_data
Expand Down

0 comments on commit fddd488

Please sign in to comment.