Skip to main content

Python library to retrieve information from "Goldenergy" client portal

Project description

Goldenergy API

Installation

pip install goldenergy

Usage

import asyncio
import aiohttp
from src.goldenergy import Goldenergy


async def main():
    session = aiohttp.ClientSession()

    goldenergy = Goldenergy(session=session, code="<NIF>", password="<PASSWORD>")
    print("LOGIN: ", await goldenergy.login())

    print("CONTRACT: ", await goldenergy.get_contract("<CONTRACT_NUMBER>"))

    print("LATEST CONTRACT: ", await goldenergy.get_latest_contract())

    print("LAST INVOICE: ", await goldenergy.get_last_invoice("<CONTRACT_NUMBER>"))

    print("CONSUMPTIONS: ", await goldenergy.get_last_consumption("<CONTRACT_NUMBER>"))

    await session.close()


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

Tests

Make sure pytest asyncio is installed

$ pip install pytest-asyncio

Execute the tests

$ pytest tests/

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

goldenergy-0.0.2.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

goldenergy-0.0.2-py3-none-any.whl (10.3 kB view hashes)

Uploaded Python 3

Supported by

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