Skip to main content

Python Module For Ripple Energy

Project description

Ripple Energy

A Python package For interacting with the Ripple Energy GraphQL API.

The primary purpose of this package is to create an interface for Home Assistant to communicate with the Ripple Energy GraphQL API however, the facility is available to develop this module further by adding additional queries / functions.


Disclaimer - I do not work for Ripple Energy however, I have memberships in some of their co-ops. While this module has been developed in consultation with Ripple Energy, I cannot guarantee it's long-term support or stability.


PyPI - Version

PyPI - Python Version


Table of Contents

To-Do

  • Create exceptions
  • Put functions into classes
  • Add linting
  • Create tests
  • Create build pipeline
  • Publish to PyPi
  • Make Async?

Installation

At present, this package has not been published to PyPi - You will therefore need to clone this repository to use it.

git clone https://github.com/danieledwardgeorgehitchcock/ripple-energy.git

This project leverages the use of Hatch for project management - please follow the installation instructions there before continuing.

Once the above has completed, enter in to the project directory

cd ripple-energy

As this package is managed by Hatch, you can start an environment which automatically pulls the project dependencies

hatch shell start

You should then be able to use the package from within this environment.

Example

from ripple_energy import RippleEnergy, RippleEnergyCredentialAuth
import asyncio
from sys import platform

if(platform == "win32"):
  asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) #Avoid event loop selector policy error in Windows 

async def main():

  auth = RippleEnergyCredentialAuth(email="YOUR_RIPPLE_EMAIL", password="YOUR_RIPPLE_PASSWORD")

  async with RippleEnergy(auth=auth) as ripple:

      #Query filter
      faqs = await ripple.faqs("business")
      
      #Full object response
      print(faqs)
      
      member = await ripple.member()

      #Filtered object response
      print(member.address)

      version = await ripple.version()

      #Simple type response
      print(version)

if __name__ == "__main__":
  asyncio.run(main())

Contributing

To add a new query to this module, add the GraphQL query into the src/ripple_energy/graphql_queries folder as a file with the extension .graphql such as: my_example_query.graphql - please see the existing queries as an example of how to write them.

In a terminal, make sure you are in the Hatch shell environment:

hatch shell start

Run the Ariadne code generator:

ariadne-codegen

If there no errors, a new client should be generated in the src/ripple_energy/graphql_client folder.

Add the new function to src/ripple_energy/ripple_energy.py - please see the existing functions as an example of how to write them.

Commit the changes and create a Pull Request in this repo.

License

ripple-energy is distributed under the terms of the MIT license.

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

ripple_energy-3.0.1.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ripple_energy-3.0.1-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file ripple_energy-3.0.1.tar.gz.

File metadata

  • Download URL: ripple_energy-3.0.1.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for ripple_energy-3.0.1.tar.gz
Algorithm Hash digest
SHA256 e90565f741219507b537267884350ea8e54aef40c65423eb89822d94d487dfad
MD5 924a4a99842e9a0cf375ad8f2a3fb192
BLAKE2b-256 583ceab004f98eabb7533613d37cc2d91effbf9390e2635acb02187eea404ba6

See more details on using hashes here.

File details

Details for the file ripple_energy-3.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ripple_energy-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e28e69beef8339b3d0411a88f7567452af0e46844051635b78788b01471aff28
MD5 133bfea9785dc3d15aa7d67314271a2c
BLAKE2b-256 22b3a7d8f1270b6fe98565d1221f66825abd556f49d048dcb83a8097b01ec2be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page