Skip to main content

EIA Open Data API Python Client

Project description

EIA Open Data API Python Client Package

This is an unofficial http client in python for the U.S. Energy Information Administration (EIA) Open Data API. It has minimal functionality and is under development. Please use it at your own risk.

The API is vast and the quickest way to get an understanding for the endpoints is to use the online browser.

Installation

You can install the package from pypi. It is recommended to install it in a virtual environment.

$ pip install eia-client

Example

Below is a quick example showing how to submit a request to the "total energy monthly" API endpoint for electricity net generation total endpoint.

import eia_client as ec

endpoint = ec.endpoint.TotalEnergy(msn="ELETPUS")

client = ec.Client()
resp = client.get(endpoint.build())

df = ec.parse.as_dataframe(resp)
print(df.head())

df.to_csv("eia_data.csv")

You can view an extended version of this example and others in examples/Quickstart_tminTutorial.ipynb.

API Key

Go to the EIA Open Data API site and create, then downlaod an API key.

The package assumes the API Key for EIA is stored in your home directory as ~/.eia.config (text) or an environment variable called EIA_API_KEY.

WARNING Don't spam the API, there is nothing in the code to protect you from going over any rate limits; save the data and request as you need.

Feature pipeline

  • Endpoint query functionality to allow the user to discover endpoints.

  • Walking endpoints without breaching rate limits.

  • Backend adapters.

  • Publish sphinx docs.

  • Add more endpoints.

  • Github workflow.

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

eia_client-0.4.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eia_client-0.4.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file eia_client-0.4.1.tar.gz.

File metadata

  • Download URL: eia_client-0.4.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.8

File hashes

Hashes for eia_client-0.4.1.tar.gz
Algorithm Hash digest
SHA256 d1f054f96ea3ef2f5f465e3216645335d88efefe06c658a07674f2221096b0a3
MD5 ee6168057b3da196fa8a9c889976ab82
BLAKE2b-256 5bf7868af6e2a4159a56a5cc5c824034edf78db61b2252a8f7b0d6f1f9272c7a

See more details on using hashes here.

File details

Details for the file eia_client-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: eia_client-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.8

File hashes

Hashes for eia_client-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd3b6023b22020573b8b25b4df8195a7549002e589f9295feafa3eb0200e5534
MD5 807747d6c552a077fdc42661fc101135
BLAKE2b-256 60ef16a7f999c6e1c3859880404146ebf66618d24da3a3a543e83e2d8844cc37

See more details on using hashes here.

Supported by

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