In test mode (options(politecollect.test_mode = TRUE)), a session stops
after politecollect.max_requests requests (10 by default), with an error
of class politecollect_request_cap, so that a script under test cannot
run a whole collection. The cap can also be set outside the test mode.
request_count()returns the requests sent so far;reset_request_count()sets the counter back to zero.
Details
Requests served from the cache are not counted. Requests that a project
sends in parallel with httr2::req_perform_parallel() do not go through
polite_request() and are not counted either.
See also
Other politeness:
check_robots(),
last_failure(),
polite_request()
Examples
request_count()
#> [1] 0
withr::with_options(
list(politecollect.test_mode = TRUE, politecollect.max_requests = 2),
getOption("politecollect.max_requests")
)
#> [1] 2