Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

replace httr::GET() with httr::RETRY() #24

Merged
merged 1 commit into from
Apr 20, 2020
Merged
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
8 changes: 5 additions & 3 deletions R/mt_dates.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ mt_dates <- function(
}

# try to download the data
json_dates <- httr::GET(url = url,
query = query,
httr::write_memory())
json_dates <- httr::RETRY(verb = "GET",
url = url,
query = query,
httr::write_memory(),
terminate_on = c(403, 404))

# trap errors on download, return a general error statement
# with the most common causes.
Expand Down
8 changes: 5 additions & 3 deletions R/mt_subset.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,11 @@ mt_subset <- function(
"kmLeftRight" = round(km_lr))

# try to download the data
json_chunk <- httr::GET(url = url,
query = query,
httr::write_memory())
json_chunk <- httr::RETRY(verb = "GET",
url = url,
query = query,
httr::write_memory(),
terminate_on = c(403, 404))

# trap errors on download, return a detailed
# API error statement
Expand Down