Skip to main content

A library to query ALSI data

Project description

alsi-py

Python client for the ALSI API (Aggregated LNG Storage Inventory)

Documentation of the API can be found at: https://alsi.gie.eu/GIE_API_documentation_v004.pdf Documentation of the client API can be found at: https://roiti-ltd.github.io/alsi-py/

Installation

python3 -m pip3 install alsi-py

Usage

The package is split in two clients:

  1. AlsiRawClient: Returns data in raw JSON format.
  2. AlsiPandasClient: Returns parsed data in the form of a pandas dataframe.
from alsi.raw_client import AlsiRawClient
from alsi.pandas_client import AlsiPandasClient
from datetime import datetime
import asyncio

API_KEY = '<API_KEY>'

country_code = 'DE'
company_code = '21X000000001368W'
facility_code = '21W000000000100J'

async def main():
    client = AlsiRawClient(api_key=API_KEY)

    # Functions that return JSON.
    client.query_data_for_facility(facility_code, company_code, country_code)
    client.query_agg_data_for_europe_or_noneurope(europe='eu')
    client.query_agg_data_by_country(contry_code='BE')
    client.query_data_by_company_and_country(company_code, country_code)

    # Filter results by time
    client.query_agg_data_by_country(country_code, start=datetime(2017,1,1), end=datetime(2018,1,1), limit=10)

    # Create pandas client. All functions are the same as the raw client.
    pandas_client = AlsiPandasClient(api_key=API_KEY)

    # In the end of the code, make sure to close the client session:
    await client.close_session()
    # or
    await pandas_client.close_session()

asyncio.run(main())

For more information regarding company codes, facility codes and country codes visit: https://alsi.gie.eu/#/api

Running unit tests

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

export PYTHONPATH=./alsi
export ALSI_KEY='...'

Run unit tests in coverage mode

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

Contributing

Pull the repository:

git clone https://github.com/ROITI-Ltd/alsi-py.git
cd ./alsi-py

Set up your working environment:

python3 -m venv env
source env/bin/activate

Install required packages:

pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt

Bumping the package version after making changes:

bumpversion major|minor|patch|build 

For more general guidelines on contributing see: Contributing to alsi-py.

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

alsi-py-1.0.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

alsi_py-1.0.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file alsi-py-1.0.2.tar.gz.

File metadata

  • Download URL: alsi-py-1.0.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for alsi-py-1.0.2.tar.gz
Algorithm Hash digest
SHA256 32f7b64ef2896b6ce9dc51a2aec105efe732f01d866b2a037b94daa2fe624e7f
MD5 b153d833f1c6be2fe271a25f5a1a655b
BLAKE2b-256 578fe5d2f4a5562ac806497493adf159635857ac711c7e2a8e75bda38cc91811

See more details on using hashes here.

File details

Details for the file alsi_py-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: alsi_py-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for alsi_py-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 20fb7abfe1f9c003afb15cf182c8d3302aa6a21b8dce05cc775a830f3d1d463a
MD5 d15813882701d9a79f9b9cc7678ac457
BLAKE2b-256 82f59f4f6ea2995bfe05a237e5bad25b74af6e776227bd36f43b982be5fdfdf6

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