Skip to contents

After preparing a request, call eia2_req_perform() to perform it, fetching the results back to R as a response.

eia2_req_perform() wraps httr2::req_perform(). The api_key is not added to the request object until the request is performed. Additionally, it applies rate limit behavior to comply with API guidelines.

Usage

eia2_req_perform(
  req,
  path = NULL,
  verbosity = NULL,
  mock = getOption("httr2_mock", NULL),
  rate = getOption("eia2_rate", 4),
  api_key = eia_get_key()
)

Arguments

req

An eia2 request.

path

Optionally, path to save body of the response.

verbosity

How much information to print? This is an integer from 0 to 3, passed to httr2::request_perform().

mock

A mocking function. Passed to httr2::request_perform().

rate

Maximum request rate in requests per second, passed to httr2::req_throttle().

api_key

Your API authentication key.