WattTime-API-Wrapper
Python API wrapper for the WattTime API: https://www.watttime.org/api-documentation
Key Features
- Full support for all endpoints and parameters.
- API key will be automatically updated once it has expired (every 30 mins).
- Built in rate limiting to comply with WattTime API ussage guidelines (3000 requests/5 mins)
- Increased performance by reusing session object accross requests.
- Additional QoL features to facilitate working with response data.
- Option to save Historical Emissions response as .zip file and extract contents.
- Option to combine extracted .csv files into a single file.
Installation Instructions
Install Requirements (If Necessary)
- Both "pandas" and "requests" libraries are required to use this library.
pip install pandas
pip install requests
Install Library
pip install watttime-api-wrapper
Usage Instructions
Register Account
- This step is only required if you do not already have a WattTime account.
from WattTime import WattTime
username = "{username}" # required
password = "{password}" # required
email = "{user@email.com}" # required
org = "{organization}" # optional
wt = WattTime.RegisterNewUser(username, password, email)
Create a Client
- Once you have registered an account, saving your username and password as environment variables is recommended.
from WattTime import WattTime
import os
username = os.getenv("WATTTIME_API_USERNAME")
password = os.getenv("WATTTIME_API_PASSWORD")
wt = WattTime.GridEmissionsInformation(username, password)
Use the Client
Determine Grid Region
latitude = 33.844978
longitude = -118.387238
wt.determine_grid_region(latitude, longitude)
The output is similar to the following:
> {'abbrev': 'CAISO_LONGBEACH', 'name': 'California ISO Long Beach', 'id': 233}
- For a full list of ussage examples, see the WattTime API Demo.ipynb notebook that has been included in this repository.
Metadata
Release files for watttime-api-wrapper 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| watttime-api-wrapper-1.0.2.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| watttime_api_wrapper-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.4 kB
Release files / watttime-api-wrapper-1.0.2.tar.gz
| Download URL | watttime-api-wrapper-1.0.2.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dbc919f56a0470a69c07f19aaa011e9d65a50cb6e759fafb5f316fe795d10f9
|
|
BLAKE2b-256 checksum How to use checksums |
832ba340f386d30108294c04a343afac49cc4664e0abf0f5a2ed3492d4b9aa1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.6
|
Release files / watttime_api_wrapper-1.0.2-py3-none-any.whl
| Download URL | watttime_api_wrapper-1.0.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc983b2d570270f33d031462a4f169d71fe5ec84c2b34383a4005dfee99e26a3
|
|
BLAKE2b-256 checksum How to use checksums |
3aa0b7740afceb1746a1f4773b7d478c8a13f86797050b90fe1944768bbb2872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.6
|