-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use download_file and fix devtools check
- Loading branch information
1 parent
5017f59
commit 3e0149b
Showing
23 changed files
with
115 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: cori.data.fcc | ||
Title: Process FCC data | ||
Version: 0.1.1 | ||
Version: 0.1.2 | ||
Authors@R: | ||
person(given="Olivier", family="Leroy", email="[email protected]", role = c("aut", "cre")) | ||
Description: Functions to get and process FCC data. | ||
|
@@ -11,20 +11,18 @@ RoxygenNote: 7.3.2 | |
Depends: | ||
R (>= 2.10) | ||
LazyData: true | ||
Suggests: | ||
testthat (>= 3.0.0), | ||
pkgdown, | ||
Suggests: | ||
dplyr, | ||
DT, | ||
knitr, | ||
rmarkdown | ||
pkgdown, | ||
rmarkdown, | ||
testthat (>= 3.0.0) | ||
Config/testthat/edition: 3 | ||
Imports: | ||
curl, | ||
Imports: | ||
duckdb, | ||
jsonlite, | ||
utils, | ||
DBI, | ||
duckdb, | ||
stringi | ||
URL: https://ruralinnovation.github.io/cori.data.fcc/ | ||
Config/Needs/website: rmarkdown | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#' Download file function (replacement for download.file) | ||
#' | ||
#' @param remote_file_url URL to download file from | ||
#' @param local_file_path Local path to save file to | ||
#' @return path to local file | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' system("mkdir -p ~/data_swamp") | ||
#' retrieved_file <- download_file( | ||
#' "https://archive.org/offshoot_assets/assets/ia-logo-2c2c2c.03bd7e88c8814d63d0fc..svg", | ||
#' "~/data_swamp/archive.svg") | ||
#' } | ||
#' | ||
#' | ||
download_file <- function (remote_file_url, local_file_path) { | ||
res <- NULL | ||
res <- system( | ||
sprintf( | ||
paste0("curl '%s' --compressed ", | ||
"-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0' ", | ||
"-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8' ", | ||
"-H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' ", | ||
"-H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' ", | ||
"-H 'Referer: https://broadbandmap.fcc.gov/data-download' ", | ||
"-H 'Sec-Fetch-Dest: document' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: none' -H 'Sec-Fetch-User: ?1' ", | ||
"-H 'Sec-GPC: 1' -H 'Priority: u=0, i' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: trailers' ", | ||
"-o %s"), | ||
remote_file_url, local_file_path | ||
) | ||
) | ||
|
||
if (is.null(res) || res > 0) { | ||
return(res) | ||
} else { | ||
return(invisible(local_file_path)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.