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
Built Distribution
Hashes for eia_client-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd3b6023b22020573b8b25b4df8195a7549002e589f9295feafa3eb0200e5534 |
|
MD5 | 807747d6c552a077fdc42661fc101135 |
|
BLAKE2b-256 | 60ef16a7f999c6e1c3859880404146ebf66618d24da3a3a543e83e2d8844cc37 |