BEA (api_key) |
The primary class in the BEApy package, handles sending requests and manipulating the results. |
BEAAPI.send_request (params) |
Base method for sending a GET request to the API. |
BEA.dataset_list () |
Get a list of all availible datasets (API method getDatasetList ) |
BEA.parameter_list (dataset) |
Get a list of availible parameters for the dataset (API method getParameterList ) |
BEA.parameter_values (dataset, parameter[, …]) |
Get a list of possible values for the parameter in a dataset (API method getParameterValues ). |
Module for sending requests to BEA API and handling errors
beapy.api.
BEAAPI
(api_key)¶Base class for communicating with the API, outputs raw JSON results.
This class communicates with the BEA API and handles possible errors,
returning unfiltered JSON results in case of success. It stores your API key
on initiation, and uses it for future requests. It serves as a base class to
enable the BEA
class to abstract from requests and error handling.
Parameters: | api_key (str ) – Your BEA API key |
---|
send_request
(params)¶Base method for sending a GET request to the API.
This method sends a GET request to the base url with the params + the API key +
JSON format and handles error messages. If successful, returns the Results
part of the response.
Parameters: | params (dict ) – Additional params to add to the GET request |
---|---|
Return type: | dict |
beapy.api.
BEAError
(status_code, message)¶Error class to handle BEA API specific errors
beapy.
BEA
(api_key)¶The primary class in the BEApy package, handles sending requests and manipulating the results. Needs to be initiated with your BEA API key once, it is stored for all later requests.
Parameters: | api_key (str ) – Your BEA API key |
---|
dataset_list
()¶Get a list of all availible datasets (API method getDatasetList
)
Returns: | A DataFrame with a description and name of availible datasets. |
---|---|
Return type: | pd.DataFrame |
parameter_list
(dataset)¶Get a list of availible parameters for the dataset (API method getParameterList
)
Usually the parameter list will also include the value of the ALL option, as well as data type, whether the parameteris is required, and whether it accepts multiple values.
Parameters: | dataset (str ) – The name of the dataset |
---|---|
Returns: | A DataFrame with a description and name of availible parameters, as well as some other options. |
Return type: | pd.DataFrame |
parameter_values
(dataset, parameter, filtering=None)¶Get a list of possible values for the parameter in a dataset (API method getParameterValues
).
Optionally, filter the list based on values of other parameters (API method
getParameterValuesFiltered
). Be careful in this case, as the filtered method is not
implemented for all datasets.
Parameters: |
|
---|---|
Returns: | A DataFrame with a description and name (key) of availible parameters values |
Return type: | pd.DataFrame |