From 8c6f53a17cd309fb8b4317db72fb77062d6030bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20S=C3=A1nchez=20Tapia?= <4183062+AndreaSanchezTapia@users.noreply.github.com.> Date: Thu, 18 Jul 2024 12:16:23 -0700 Subject: [PATCH] adding agent calls to event --- R/get_event.R | 6 ++++-- R/get_raster.R | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/get_event.R b/R/get_event.R index 5f09f82..02c7e7d 100644 --- a/R/get_event.R +++ b/R/get_event.R @@ -272,7 +272,8 @@ get_event <- function(event_type, endpoint <- base %>% httr2::req_url_path_append('events') %>% httr2::req_url_query(!!!url_args) %>% - httr2::req_body_raw(., body = body_args) + httr2::req_body_raw(., body = body_args) %>% + httr2::req_user_agent(gfw_user_agent()) if (print_request) print(endpoint) # API call; will paginate if necessary, otherwise return list with one response @@ -532,7 +533,8 @@ get_event_stats <- function(event_type, endpoint <- base %>% httr2::req_url_path_append('events/stats') %>% - httr2::req_body_raw(body = body_args) + httr2::req_body_raw(body = body_args) %>% + httr2::req_user_agent(gfw_user_agent()) if (print_request) print(endpoint) # API call; will paginate if necessary, otherwise return list with one response diff --git a/R/get_raster.R b/R/get_raster.R index dcc4a74..c3e17ef 100644 --- a/R/get_raster.R +++ b/R/get_raster.R @@ -112,6 +112,7 @@ if (is.null(region_source)) stop("region_source and region params are required") #httr2::req_error(req = ., body = parse_response_error) if (print_request) print(request) response <- request %>% + httr2::req_user_agent(gfw_user_agent()) %>% httr2::req_perform(.) %>% httr2::resp_body_raw(.)