Skip to content

octoenergy/oejp-api-example

Repository files navigation

Octopus Energy Japan API example project

A few examples using the Octopus Energy API

Local setup

Make sure your Python version is >= 3.8

Create a virtual environment and install dependencies:

python -m venv env
pip install -r requirements.txt

Add a .env file to your project root like so:

API_URL=https://api.oejp-kraken.energy/v1/graphql/  # or a different URL if you're not with Octopus Energy Japan
OCTOPUS_EMAIL=<YOUR EMAIL>
OCTOPUS_PASSWORD=<YOUR PASSWORD>

Run a local API with FastAPI

uvicorn main:app --reload

You should be able to use the browsable FastAPI to try the API out at http://localhost:8000/docs.

API docs screenshot

Print energy usage with rich

Calculate basic statistics about your electricity usage. The output is saved as an svg.

python usage.py 2022-10-01 2022-10-14

usage screenshot

About

An Example of Using the Octopus Energy API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published