Skip to main content

A python API client library for the US Bureau of Economic Analysis

Project description

Python Bureau Of Economic Analysis API Client

Table of Contents

Overview

An Python API client used to pull and retrieve data from the US Bureau of Economic Analysis.

Grab an API Key

To grab an API key, you'll need to setup an account with the Bureau Of Economic Analysis. Go to the API Homepage and fill out the register form on the left hand side. Once filled out an API key will be sent to your email.

Setup

Right now, the library is not hosted on PyPi so you will need to do a local install on your system if you plan to use it in other scrips you use.

First, clone this repo to your local system. After you clone the repo, make sure to run the setup.py file, so you can install any dependencies you may need. To run the setup.py file, run the following command in your terminal.

pip install python-bea

This will install all the dependencies listed in the setup.py file. Once done you can use the library wherever you want.

Usage

Here is a simple example of using the pybea library to grab a list of the different datasets availabel.

from pprint import pprint
from pybea.client import BureauEconomicAnalysisClient

# Initalize the new Client.
bea_client = BureauEconomicAnalysisClient(api_key='YOUR_API_KEY_HERE')

# Grab the Dataset List.
dataset_list = bea_client.get_dataset_list()
pprint(dataset_list)

You will note the output of the above code would look like the following:

{
  "BEAAPI": {
    "Request": {
      "RequestParam": [
        {
          "ParameterName": "METHOD",
          "ParameterValue": "GETPARAMETERLIST"
        },
        {
          "ParameterName": "RESULTFORMAT",
          "ParameterValue": "JSON"
        }
      ]
    },
    "Results": {
      "Parameter": [
        {
          "ParameterName": "GeoFips",
          "ParameterDataType": "string",
          "ParameterDescription": "Comma-delimited list of 5-character geographic codes; COUNTY for all counties, STATE for all states, MSA for all MSAs, MIC for all Micropolitan Areas, PORT for all state metro/nonmetro portions, DIV for all Metropolitan Divisions, CSA for all Combined Statistical Areas, state post office abbreviation for all counties in one state (e.g. NY)",
          "ParameterIsRequiredFlag": "1",
          "MultipleAcceptedFlag": "1"
        },
        {
          "ParameterName": "Year",
          "ParameterDataType": "string",
          "ParameterDescription": "Comma-delimted list of years; LAST5 for latest 5 years; LAST10 for latest 10 years; ALL for all years",
          "ParameterIsRequiredFlag": "0",
          "ParameterDefaultValue": "LAST5",
          "MultipleAcceptedFlag": "1"
        }
      ]
    }
  }
}

Support these Projects

Patreon: Help support this project and future projects by donating to my Patreon Page. I"m always looking to add more content for individuals like yourself, unfortuantely some of the APIs I would require me to pay monthly fees.

YouTube: If you"d like to watch more of my content, feel free to visit my YouTube channel Sigma Coding.

Hire Me: If you have a project, you think I can help you with feel free to reach out at coding.sigma@gmail.com or fill out the contract request form

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-bea-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

python_bea-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file python-bea-0.1.0.tar.gz.

File metadata

  • Download URL: python-bea-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.4

File hashes

Hashes for python-bea-0.1.0.tar.gz
Algorithm Hash digest
SHA256 100f0be2f914a9f7bc6e652dfa2313e746946d6e428cdbc650f0a8abd889ca13
MD5 22ead687b0153a57cbd9b475b6699588
BLAKE2b-256 363f95c286996926b60c93d78deec628f6feb6ba0cddafdd7a52902d8333af2b

See more details on using hashes here.

File details

Details for the file python_bea-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_bea-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.4

File hashes

Hashes for python_bea-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c325a5ea87a9d2edeecf67536a4eb50ea73745264482f708544cdfed51088dfc
MD5 48ae12668ddb443fea48eefc8aa209c4
BLAKE2b-256 7fd235da502f51b56ef5fbe3625bce39232391b53fd130277347c32ebb554b61

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page