req_throttle | 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 httr2 request object. |
rate |
Maximum rate, i.e. maximum number of requests per second.
Usually easiest expressed as a fraction,
|
realm |
A string that uniquely identifies the throttle pool to use (throttling limits always apply per 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 we never send more than 30 requests a minute
req <- request(example_url()) |>
req_throttle(rate = 30 / 60)
resp <- req_perform(req)
throttle_status()
resp <- req_perform(req)
throttle_status()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.