Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a function that is retrying a request if server sending some error #4

Open
defuneste opened this issue Jul 9, 2024 · 2 comments

Comments

@defuneste
Copy link
Contributor

No description provided.

@defuneste
Copy link
Contributor Author

This is one is specifically needed here

cori.data.fcc/R/dl_nbm.R

Lines 44 to 58 in cfa68e8

for (i in seq_len(nrow(one_release_to_dl))) {
dest_file <- paste0(path_to_dl, "/",
one_release_to_dl$file_name[i],
".zip")
if (file.exists(dest_file)) {
print(paste(dest_file, "already downloaded, skipping it"))
next
}
try(utils::download.file(url = paste0(base_url, one_release_to_dl$id[i], "/1"),
destfile = dest_file,
headers = c("User-Agent" = user_agent), ...))
}

where it should check the result of an upload and retry before looping (apply should be used also)

@defuneste
Copy link
Contributor Author

I do not like that design, the original purpose was to download all FCC data needed. But now I think it is better to move that loop outside the function (and let R and user deal with it), sadly the filter will not handle it well, hence this function should get some rework! cc @dancingfrog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant