{"id":27608,"library":"beaapi","title":"BEA API Python package","description":"A Python wrapper for the U.S. Bureau of Economic Analysis (BEA) API. Version 0.2.0 provides programmatic access to BEA data such as GDP and regional statistics. Released periodically; currently in early active development.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/us-bea/beaapi","tags":["bea","economic-data","api-wrapper"],"install":[{"cmd":"pip install beaapi","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"This is the primary class for interacting with the BEA API.","symbol":"BEAAPI","correct":"from beaapi import BEAAPI"}],"quickstart":{"code":"from beaapi import BEAAPI\nimport os\n\napi_key = os.environ.get('BEA_API_KEY', '')\nif not api_key:\n    raise ValueError(\"Set BEA_API_KEY environment variable\")\n\nbea = BEAAPI(api_key)\nparams = {\n    'UserID': api_key,\n    'Method': 'GetDataSetList',\n    'ResultFormat': 'JSON'\n}\nresponse = bea.get_data(params)\nprint(response)\n","lang":"python","description":"Initialize BEAAPI with an API key and make a sample request to list datasets."},"warnings":[{"fix":"Always pass the API key explicitly: BEAAPI(api_key) or set an environment variable and load it manually.","message":"The API key must be provided as a parameter to the BEAAPI constructor; there is no environment variable autoloading.","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Pass params as a single dictionary with keys like 'UserID', 'Method', etc.","message":"The get_data method expects a flat dictionary of params, not nested. Common mistake: including parameters inside an extra dict.","severity":"gotcha","affected_versions":"all"},{"fix":"Switch to BEAAPI(api_key).get_data(params).","message":"The older pattern BEAAPI().get_data() without explicit API key is deprecated in favor of passing key to constructor.","severity":"deprecated","affected_versions":"<0.2.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use BEAAPI(api_key) with your API key.","cause":"Instantiating BEAAPI without arguments when the constructor expects an API key.","error":"TypeError: BEAAPI() takes no arguments"},{"fix":"Create an instance first: api = BEAAPI(key); api.get_data(params).","cause":"Calling get_data directly on the module instead of on an instance.","error":"AttributeError: module 'beaapi' has no attribute 'get_data'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}