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

Commit

Permalink
Merge pull request #24 from annnvv/httr_retry
Browse files Browse the repository at this point in the history
replace httr::GET() with httr::RETRY()
  • Loading branch information
khufkens authored Apr 20, 2020
2 parents db65c28 + e1c9feb commit 11e7139
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit 11e7139

Please sign in to comment.