Code Monkey home page Code Monkey logo

lowatt-grdf's Introduction

lowatt-grdf

A command-line tool and Python library to access GrDF Adict API, provided by Lowatt.

Licensing

It is published under the terms of the MIT license.

Installation

pip install lowatt-grdf

Command line usage

$ lowatt-grdf --help
Usage: lowatt-grdf [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  declare-acces
  donnees-consos-informatives
  donnees-consos-publiees
  donnees-contractuelles
  donnees-techniques
  droits-acces

Each subcommand implement the related API endpoint and output json that can easily be piped to jq for reading. Also each command will require to supply --client-id and --client-secret, or via corresponding environment variables CLIENT_ID and CLIENT_SECRET. These access are only provided by GRDF.

The droits-acces subcommand has also a --check parameter which will check consent validation:

  • statut_controle_preuve must not be Preuve en attente or Preuve Vérifiée KO
  • etat_droit_acces must be Active

This command is intended to be used at a daily basis in CI or cron, raising an alert in case of error, because it will require a manual correction.

Python library usage

Here is a sample code to access to the donnees-consos-publiees endpoint:

from lowatt_grdf.api import API

client_id = "ID"
client_secret = "SECRET"
pce = "23000000000000"

grdf = API(client_id, client_secret)
for releve in grdf.donnees_consos_publiees(pce, from_date="2021-01-01", to_date="2021-08-23"):
  conso = releve["consommation"]
  print(conso["date_debut_consommation"], conso["date_fin_consommation"], conso["energie"])

Contributions

Contribution are welcome through the Github repository.

Feel free to contact for more info by writing at [email protected].

lowatt-grdf's People

Contributors

philpep avatar sthenault avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.