Check httr response code and cache locally results
Source:R/cas_check_response.R
cas_check_response.RdCheck httr response code and cache locally results
Usage
cas_check_response(
url = NULL,
followlocation = TRUE,
url_encode = TRUE,
wait = 1,
output_only_newly_checked = FALSE,
output_only_cached = FALSE,
cache_invalidate = NULL,
index = FALSE,
index_group = NULL,
db_connection = NULL,
disconnect_db = FALSE,
check_db = TRUE,
write_db = TRUE,
...
)Arguments
- url
A character vector of urls, or a data frame with a
urlcolumn, typically retrieved withcas_get_urls_df().- followlocation
Logical, defaults to
TRUE, passed tohttr2::req_options(). IfTRUE, follows all redirects and reports data about the final response url is reached. IfFALSE, it reports the status message of the original server even if a redirect was set; the code of the original redirect is reported, and the destination of the redirect is returned in theresponse_urlcolumn. Data with and withoutfollowlocationenabled are stored in separate databases.- url_encode
Logical, defaults to
TRUE. IfTRUE, it parses the urls withURLencode(repeated=FALSE)in order to process correctly URLs including e.g. spaces or other special characters.- wait
Defaults to 1. Number of seconds to wait between downloading one page and the next. Can be increased to reduce server load, or can be set to 0 when this is not an issue.
- output_only_cached
Defaults to
FALSE. IfTRUE, only previously cached responses are kept.- cache_invalidate
Defaults to
NULL. If given, it can be either a date or date time object, or a character vector than can be coerced withas.POSIXct(); only responses cached since that date will be kept. If numeric, it is understood as number of days: only cached responses more recent than the given number of days will be kept.- check_db
Defaults to TRUE. If TRUE, checks if given URL has already been checked in local database, and queries APIs only for URLs that have not been previously checked.
- write_db
Defaults to TRUE. If TRUE, writes result to a local database.
- ...
Passed to
cas_get_db_file().