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 started is to use the online browser to select the API route you would like to query.
Mnemonic Series Names (MSN) - This is a unique identifier used by EIA for data series.
Example MSN:
Electricity Net Generation Total
The MSN is "ELETPUS".
Installation
TODO: add installation section
TODO: put package on pypi
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
# Under the hood this reads your API key and builds it into the requests.
builder = ec.EndpointBuilder()
endpoint = builder.total_energy_monthly(msn="ELETPUS")
resp = ec.client.get(endpoint)
df = ec.parse.as_dataframe(resp)
print(df.head())
df.to_parquet("eia_data.parquet")
You can view an extended version of this example 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.
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.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 337d73fccf7ff8a544faf46db5a0d2d63aa9ea74be216774c973e6951120fd31 |
|
MD5 | 96bf0a17069707ec717954001e32e2a9 |
|
BLAKE2b-256 | a18125e9c21c179d7e09f7f570931e47973d32f11437fe59443a4a1ae7292f6d |