Wrapper for communicating with the Octopus Energy API
Project description
GitHub: github.com/euanacampbell/octopus_energy_api
PyPi: pypi.org/project/octopus-energy-api
Installation
pip install octopus-energy-api
Import
from octopus_energy_api import oe_api
Usage
Two ways of creating an API instance.
Load access details in manually - Can be found using this fantastic tutorial by Guy Lipman guylipman.medium.com.
from octopus_energy_api import oe_api
account_number = ""
api_key = ""
mpan = ""
serial_number = ""
energy_api = oe_api(account_number, api_key, mpan=mpan, serial_number=serial_number)
Get mpan and serial numbers from account number + api key. (currently only works for single property accounts)
from octopus_energy_api import oe_api
api_key = "value here"
account_number = "value here"
energy_api = oe_api(account_number, api_key)
To confirm this worked, the below can be used. A valid response should be returned.
energy_api.account_details()
Consumption Data
from octopus_energy_api import oe_api
import datetime
energy_api = oe_api(account_number, api_key, mpan=mpan, serial_number=serial_number)
today = datetime.date.today() # setting end date to today
start = today.replace(day=1) # setting start date to the beginning of the month
energy_api.consumption(start, today)
Product Data
from octopus_energy_api import oe_api
energy_api = oe_api(account_number, api_key, mpan=mpan, serial_number=serial_number)
energy_api.products()
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
Close
Hashes for octopus_energy_api-0.5.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6efb8943515270cd0c6839d2a4025f78ebcd23f5423e96fbc95db014fc0a1516 |
|
MD5 | 76531adb5a9e72a502109155b78e40a6 |
|
BLAKE2b-256 | 20d8a5477aa3a07aca30021adce584b2fffbc0ac2ab54f3d507cc2707be93da9 |