A simple wrapper for the EIA API.
Project description
eiapy
Python 3 wrapper for the U.S. Energy Information Administration API.
Quick start
pip install eiapy
Get the last 5 measurements of the electricity flow between California and Mexico.
>>> from eiapy import Series
>>> cal_to_mex = Series('EBA.CISO-CFE.ID.H')
>>> cal_to_mex.last(5)
{'request': {'command': 'series', 'series_id': 'EBA.CISO-CFE.ID.H'},
'series': [{'data': [['20180401T07Z', -11],
['20180401T06Z', -16],
['20180401T05Z', -11],
['20180401T04Z', -7],
['20180401T03Z', -5]],
'description': 'Timestamps follow the ISO8601 standard '
'(https://en.wikipedia.org/wiki/ISO_8601). Hourly '
'representations are provided in Universal Time.',
'end': '20180401T07Z',
'f': 'H',
'name': 'Actual Net Interchange for California Independent System '
'Operator (CISO) to Comision Federal de Electricidad '
'(CFE), Hourly',
'series_id': 'EBA.CISO-CFE.ID.H',
'start': '20150701T00Z',
'units': 'megawatthours',
'updated': '2018-04-02T08:43:16-0400'}]}
For more details about the API go to the EIA's Open Data page. To find interesting data (and identifiers) browse the data sets.
Go here to see the API terms of service and here for an explanation of copyright and reuse of their data.
Notes on API behaviour
- When providing invalid time limits for a series data request an empty data list is returned.
- For data requests num & start cannot be used together but num & end can.
- When an invalid series id is passed this is the response.
{'request': {'series_id': 'eba.ciso-cfe.id.', 'command': 'series', 'num': '5'},
'data': {'error': 'invalid series_id. For key registration, documentation, and
examples see https://www.eia.gov/developer/'}}
Changelog
0.1.1
- Started using requests session functionality to improve performance.
- Fixed a mistake in the MultiSeries class that stopped it working entirely.
- Added a version attribute to the package.
- Overhaul of readme.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eiapy-0.1.1.tar.gz.
File metadata
- Download URL: eiapy-0.1.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a014515bc88a35f5441f9c8eb72d55a3e62beb2c0d33cf45af96ca2ad5d5643
|
|
| MD5 |
cf0ddfd13f8e34dd5c7fdad83c6b304b
|
|
| BLAKE2b-256 |
bb18ddb2097e1fd5571079ecd1ff59b52a31d882b871c6a21827468c5d2f0f54
|
File details
Details for the file eiapy-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: eiapy-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47aa3477ef7a12ba2e34a8372085e4c3daad2c28c5086ac81ec673da74f378e5
|
|
| MD5 |
43b6178e6ab86d6d6eb7660b257ff3a7
|
|
| BLAKE2b-256 |
37e7fc6ff8c4ba9ab895c6cebf0342553ff603b563d151c8edad5564bcfed8c4
|