Obtain info about the API quota used

get_quota_from(service = c("meteocat"), options)

Arguments

service

Character with the service name (in lower case).

options

List with the needed service options. See services_options to have more info about the different services and their options.

Value

A data frame with the quota info

Details

Depending on the service, some APIs allows only a number of data requests. This function access the user quota numbers in the services that allow for this, (currently only MeteoCat)

Examples

# \donttest{
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
  library(meteospain)
  library(keyring)

  # MeteoCat (we need a key)
  # key_set('meteocat')
  api_options <- meteocat_options(api_key = key_get('meteocat'))
  get_quota_from('meteocat', api_options)
}
#> # A tibble: 5 × 5
#>   nom              periode maxConsultes consultesRestants consultesRealitzades
#>   <chr>            <chr>          <int>             <int>                <int>
#> 1 Prediccio_8000   Mensual         8000              8000                    0
#> 2 Referència Bàsic Mensual         2000              2000                    0
#> 3 XDDE_1500        Mensual         1500              1500                    0
#> 4 XEMA_20000       Mensual        20000             11257                 8743
#> 5 Quota            Mensual          300               262                   38
# }