req_throttle {httr2} | R Documentation |
Use req_throttle()
to ensure that repeated calls to req_perform()
never
exceed a specified rate.
req_throttle(req, rate, realm = NULL)
req |
A request. |
rate |
Maximum rate, i.e. maximum number of requests per second.
Usually easiest expressed as a fraction,
|
realm |
An unique identifier that for throttle pool. If not supplied, defaults to the hostname of the request. |
A modified HTTP request.
req_retry()
for another way of handling rate-limited APIs.
# Ensure server will never recieve more than 10 requests a minute
request("https://example.com") %>%
req_throttle(rate = 10 / 60)