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.4.tar.gz (3.5 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.4-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: g9_api_client-0.0.4.tar.gz
  • Upload date:
  • Size: 3.5 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.4.tar.gz
Algorithm Hash digest
SHA256 72d130794905b7ca7defa43ff54a7141f09f4bd24a104d76fb37f36aa0552156
MD5 6fa767053fd8e81a2fb876d3604d92bd
BLAKE2b-256 4220afe473d8af6485657c0907e759e2a527492b1fadf95feb7fec9d0f18f94a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: g9_api_client-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6f08d986665eec00bb331dc7e8d24e88a8c37f4169865a2e953d8837b67510e8
MD5 9f097b5e8d5de16071e145bb9dc9111d
BLAKE2b-256 49dfba8c59e8649d351d514513bbdba7c453b9212c26d645ec88dd27b4f0aa9b

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