Skip to main content

Python library to retrieve information from "G9" portal

Project description

G9 API Client

G9 API Client is a Python library for interacting with the G9 API. It allows you to log in, retrieve contracts, and get the latest invoices and consumption data for electricity and gas.

Installation

You can install the G9 API Client using pip:

pip install g9_api_client

Usage

Here is an example of how to use the G9 API Client:

import asyncio
import aiohttp
from g9_api_client import G9

async def main():
    session = aiohttp.ClientSession()
    acc = G9(session,"your_username", "your_password")

    if await acc.login():
        print("Login successful")
        contracts = await acc.get_contracts()
        if contracts:
            contract_id = contracts[0].get('id')
            print("Contracts:", contracts)
            print("Last Invoice:", await acc.get_last_invoice(contract_id))
            print("Last Electricity Consumption:", await acc.get_last_electricity_consumption(contract_id))
            print("Last Gas Consumption:", await acc.get_last_gas_consumption(contract_id))
        else:
            print("No contracts found")
    else:
        print("Login failed")

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

Methods

login()

Logs in to the G9 API using the provided username and password.

get_contracts()

Retrieves the list of contracts associated with the logged-in user.

get_last_invoice(contract_id)

Retrieves the last invoice for the specified contract.

get_last_electricity_consumption(contract_id)

Retrieves the last electricity consumption data for the specified contract.

get_last_gas_consumption(contract_id)

Retrieves the last gas consumption data for the specified contract.

License

This project is licensed under the Apache 2 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

g9_api_client-0.0.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

g9_api_client-0.0.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file g9_api_client-0.0.5.tar.gz.

File metadata

  • Download URL: g9_api_client-0.0.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for g9_api_client-0.0.5.tar.gz
Algorithm Hash digest
SHA256 cb1c5ba33ab7fbcda0e378d9a04e85bde9d052f89039ba461825179a3ed3f0e9
MD5 69c8b7490421d51d7dcfc5970696d3c1
BLAKE2b-256 4c4c9aa3ab42ea039710c044a10f20ba88e842d9f7572b35dfb692d8462e539a

See more details on using hashes here.

File details

Details for the file g9_api_client-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: g9_api_client-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for g9_api_client-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ee729ad382bfc90f4dbda672c2b37a094fad13f9f66d9e115b23482f4c48ae8c
MD5 09a16e920dddfd03cda47363d3509b04
BLAKE2b-256 b8e659d56f641c4b4da2d57bf1f55e89554ba649c81e72648b8d7671e9bc7c5b

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