Skip to content

Commit 0954140

Browse files
committed
query FAA data via GET (#21)
Now passing along a user agent.
1 parent 12102ea commit 0954140

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

R/utils.R

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ get_planes_data <- function(year, dir, flights_data) {
455455

456456
# put together the url to query the planes data at
457457
planes_src <- paste0(
458-
"http://registry.faa.gov/database/yearly/ReleasableAircraft.",
458+
"https://registry.faa.gov/database/yearly/ReleasableAircraft.",
459459
year,
460460
".zip"
461461
)
@@ -466,8 +466,13 @@ get_planes_data <- function(year, dir, flights_data) {
466466

467467
# download the planes data
468468
planes_tmp <- tempfile(fileext = ".zip")
469-
download_file_wrapper(planes_src, planes_tmp, quiet = TRUE)
470-
469+
planes_response <-
470+
httr::GET(
471+
planes_src,
472+
httr::user_agent("anyflights"),
473+
httr::write_disk(planes_tmp, overwrite = TRUE)
474+
)
475+
471476
# ...and unzip it!
472477
utils::unzip(planes_tmp, exdir = planes_lcl, junkpaths = TRUE)
473478

@@ -515,10 +520,12 @@ process_planes_ref <- function(planes_lcl) {
515520
# download the planes acftref data
516521
planes_tmp <- tempfile(fileext = ".zip")
517522

518-
download_file_wrapper(
519-
"http://registry.faa.gov/database/yearly/ReleasableAircraft.2019.zip",
520-
planes_tmp,
521-
quiet = TRUE)
523+
planes_response <-
524+
httr::GET(
525+
"https://registry.faa.gov/database/yearly/ReleasableAircraft.2019.zip",
526+
httr::user_agent("anyflights"),
527+
httr::write_disk(planes_tmp, overwrite = TRUE)
528+
)
522529

523530
# ...and unzip it!
524531
utils::unzip(planes_tmp, exdir = planes_lcl, junkpaths = TRUE)

0 commit comments

Comments
 (0)