bea package¶
Submodules¶
bea.api module¶
This module contains specifics based on the current documentation, to make calls and consume the data released by the BEA.
Although the BEA (at the time of this writing) supports both XML and JSON responses; this module does not have XML response support at this time, only JSON and Python types.
API Calling Limits¶
The API has default calling limits as shown below. These limits are meant to protect BEA’s API and webserver infrastructure from activity that may be detrimental to that infrastructure and/or unfairly impede other API users.
- 1000 API calls per minute, and/or
- 30 errors per minute, and/or
- 50 MB (raw data) per minute.
Any user that exceeds the above calling limits will receive an explanatory error message for each API call until the per-minute cause has expired. The best way to avoid such errors is to design your application to call the API within these limits, e.g., programmatically regulate the frequency/size of API calls.
-
class
bea.api.BaseHandler(user_key, result_format='JSON')[source]¶ Bases:
objectThis is the super class handler with attributes common to all subclassed handlers for BEA requests
-
_get_and_process_response(url, target_node, echo_request=False)[source]¶ Takes the request URL and a target node, delegating to a few other helper methods to unpack and process the response.
Parameters: Returns: The targeted data results as JSON
Return type: JSON
-
_traverse_nodes(response, node_hierarchy)[source]¶ Parameters: - response –
- node_hierarchy –
Returns: Return type:
-
-
class
bea.api.DataHandler(user_key, result_format='JSON')[source]¶ Bases:
bea.api.BaseHandler
-
class
bea.api.MetadataHandler(user_key, result_format='JSON')[source]¶ Bases:
bea.api.BaseHandler-
get_dataset_list(target_node='Dataset', echo_request=False)[source]¶ Retrieves the BEA datasets list
Parameters: Returns: The targeted data results as JSON
Return type: JSON
-
get_param_list(dataset_name, target_node='Parameter', echo_request=False)[source]¶ Parameters: - dataset_name –
- target_node –
- echo_request –
Returns: Return type:
-