Skip to main content

A library to query GIE ALSI/AGSI data

Project description

Introduction

Python client for the ALSI/AGSI APIs

Documentation of the API can be found on GIE's website

Documentation of the client API can be found on: https://roiti-ltd.github.io/gie-py/

Installation

python -m pip install roiti-gie

Usage

The package is split in two clients:

  1. GieRawClient: Returns data in raw Python Dict.
  2. GiePandasClient: Returns parsed data in the form of a pandas DataFrame.
import asyncio
import os

from roiti.gie import GiePandasClient


async def main():
    """
    The following methods return pandas DataFrame, however you can use the
    raw client "raw_client = GieRawClient(api_key=Your API key)" and you will get the results as
    Python dictionaries.

    NOTE that every method available for AGSI is also available for ALSI
    """

    API_KEY = os.getenv("API_KEY")
    pandas_client = GiePandasClient(api_key=API_KEY)

    # You can specify the country, start date, end date, size (the number of results) in order to get country storage
    await pandas_client.query_country_agsi_storage("AT", start="2020-01-01", end="2022-07-10", size=60)

    # You can run the query without any parameters (in order to get all countries result)
    await pandas_client.query_country_alsi_storage()

    # You can use this query in order to get all AGSI/ALSI EICs (Energy Identification Code)
    await pandas_client.query_alsi_eic_listing()

    # Query which lists all the ALSI/AGSI news (without params)
    await pandas_client.query_alsi_news_listing()

    # Query which lists the news for a specific country (using the url code)
    await pandas_client.query_alsi_news_listing(43419)

    # Query which lists the data for a current facility storage (provide the storage name and params)
    await pandas_client.query_agsi_facility_storage("ugs_haidach_astora", start="2022-10-10")

    # You can list the data for a current storage only using its name
    await pandas_client.query_alsi_facility_storage("dunkerque")

    # Query which lists the data for a current company (also date and size are by choice)
    await pandas_client.query_agsi_company("astora", size=60)
    await pandas_client.query_alsi_company("dunkerque_lng", size=200)

    # Query which lists the unavailability for a current country (country name, date, size are optional)
    await pandas_client.query_agsi_unavailability("GB", size=60)
    await pandas_client.query_agsi_unavailability()
    await pandas_client.query_alsi_unavailability("FR")

    await pandas_client.close_session()


# set_event_loop_policy method is used in order to avoid EventLoopError for Windows
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())

Running unit tests

Tell pytest where to look for unit tests and create env for ALSI API key

  • On Unix

    export PYTHONPATH=./src/roiti
    export API_KEY='<API_KEY>'
    
  • On Windows

    $env:PYTHONPATH='./src/roiti'
    $env:API_KEY='<API_KEY>'
    

Run unit tests in coverage mode

python -m pytest ./tests --import-mode=append --cov

Contributing

Set up your working environment:

  1. Create virtual environment

    python -m venv venv
    
  2. Activate the virtual environment

    • On UNIX system

      source venv/bin/activate
      
    • On Windows system

      ./venv/Scripts/activate
      

Install required packages:

python -m pip install -r requirements.txt -r requirements-dev.txt

Bumping the package version after making changes:

bumpversion major|minor|patch|build

Aknowledgements

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

roiti-gie-0.0.2.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

roiti_gie-0.0.2-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file roiti-gie-0.0.2.tar.gz.

File metadata

  • Download URL: roiti-gie-0.0.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.15

File hashes

Hashes for roiti-gie-0.0.2.tar.gz
Algorithm Hash digest
SHA256 fdd79d95bf60a0e40a56d956861f1e54815ce9ab8d40b14dade13315b508fa57
MD5 b27e5012772d3c9f51e2bdb219c828d5
BLAKE2b-256 c360ec1ae0ac0b36fbca8331033fcfc1f8898437b56e26c4c511dc0e5d56d929

See more details on using hashes here.

File details

Details for the file roiti_gie-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: roiti_gie-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.15

File hashes

Hashes for roiti_gie-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 14aadd6d7e5f716ed9a5a457e604c3efbd58bf6804804f88780113fdfef3926a
MD5 0fe921b0902a79cd53f0f6ca42f823aa
BLAKE2b-256 d55d1e6db7ebc5792eb6233d3269901c8ec9d732362cef6418806a23cfb86a72

See more details on using hashes here.

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