alsi package

Submodules

alsi.exceptions module

exception alsi.exceptions.AccessDeniedException

Bases: Exception

exception alsi.exceptions.InvalidCountryException

Bases: Exception

alsi.mappings module

class alsi.mappings.Area(value)

Bases: Enum

An enumeration.

BE = 'BE'
ES = 'ES'
ES_ = 'ES*'
FR = 'FR'
GB_POST_BREXIT = 'GB*'
GB_PRE_BREXIT = 'GB'
GR = 'GR'
HR = 'HR'
IT = 'IT'
LT = 'LT'
NL = 'NL'
PL = 'PL'
PT = 'PT'
property code: str
classmethod has_member(member) bool
alsi.mappings.retrieve_country(input: Union[Area, str]) Area

alsi.pandas_client module

class alsi.pandas_client.AlsiPandasClient(api_key: str, session: Optional[ClientSession] = None)

Bases: AlsiRawClient

Client to perform API calls and return dataframes for ALSI API: https://alsi.gie.eu/#/api

async query_agg_data_by_country(country_code: Union[Area, str], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0) DataFrame

Aggregated historical data export for a specific country

Parameters

country_codeUnion[‘Area’, str]

2 digit country code or the name of the country

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if country code is invalid

Examples

>>> from alsi.raw_client import AlsiPandasClient
>>> API_KEY='...'
>>> client = AlsiPandasClient(api_key=API_KEY)
>>> result = await client.query_agg_data_by_country(country_code=Area.BE)
async query_agg_data_for_europe_or_noneurope(europe: typing_extensions.Literal[ne, eu], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0) DataFrame

Aggregated historical data export for Europe or Non Europe

Parameters

europeLiteral[‘ne’, ‘eu’]

‘ne’ for noneurope, eu for europe

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if europe: str parameter is not provided or invalid

Examples

>>> from alsi.raw_client import AlsiPandasClient
>>> from datetime import datetime
>>> API_KEY='...'
>>> client = AlsiPandasClient(api_key=API_KEY)
>>> result = await client.query_agg_data_for_europe_or_noneurope(europe='eu', start=datetime(2017,3,3), end=datetime(2019, 1,1), limit=10)
async query_data_by_company_and_country(company_code: str, country_code: Union[Area, str], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0) DataFrame

Historical data export for a specific company within a country

Parameters

company_codestr

21 digic EIC company code

country_codeUnion[‘Area’, str]

2 digit country code or the name of the country

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if country code or company code is invalid

Examples

>>> from alsi.raw_client import AlsiPandasClient
>>> from datetime import datetime
>>> API_KEY='...'
>>> client = AlsiPandasClient(api_key=API_KEY)
>>> result = await client.query_data_by_company_and_country(company_code='21X000000001006T', country_code='be', start=datetime(2017, 3, 3))
async query_data_for_facility(facility_code: str, company_code: str, country_code: Union[Area, str], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0) DataFrame

Query historical data export for a specific facility from a company within a country

Parameters

facility_codestr

21 digit EIC code of the facility

company_codestr

21 digit EIC code of the company

country_codeUnion[‘Area’, str]

2 digit country code or the name of the country

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if country code, company code or facility code is invalid

Examples

>>> from alsi.raw_client import AlsiPandasClient
>>> API_KEY='...'
>>> client = AlsiPandasClient(api_key=API_KEY)
>>> result = await client.query_data_for_facility(facility_code='18W000000000GVMT', company_code='21X0000000013368', country_code='es')

alsi.raw_client module

class alsi.raw_client.AlsiRawClient(api_key: str, session: Optional[ClientSession] = None)

Bases: object

Client to perform API calls and return JSON data for ALSI API: https://alsi.gie.eu/#/api

BASE_URL = 'https://alsi.gie.eu/api/data'
async close_session() None

Close the session.

async query_agg_data_by_country(country_code: Union[Area, str], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0) list

Aggregated historical data export for a specific country

Parameters

country_codeUnion[‘Area’, str]

2 digit country code or the name of the country

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if country code is invalid

Examples

>>> from alsi.raw_client import AlsiRawClient
>>> API_KEY='...'
>>> client = AlsiRawClient(api_key=API_KEY)
>>> result = await client.query_agg_data_by_country(country_code='be')
async query_agg_data_for_europe_or_noneurope(europe: typing_extensions.Literal[eu, ne], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0) list

Aggregated historical data export for Europe or Non Europe

Parameters

europeLiteral[‘eu’, ‘ne’]

‘ne’ for noneurope, eu for europe

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if europe: str parameter is not provided or invalid

Examples

>>> from alsi.raw_client import AlsiRawClient
>>> from datetime import datetime
>>> API_KEY='...'
>>> client = AlsiRawClient(api_key=API_KEY)
>>> result = await client.query_agg_data_for_europe_or_noneurope(europe='eu', start=datetime(2017,3,3), end=datetime(2019, 1,1), limit=10)
async query_data_by_company_and_country(company_code: str, country_code: Union[Area, str], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0)

Historical data export for a specific company within a country

Parameters

company_codestr

21 digic EIC company code

country_codeUnion[‘Area’, str]

2 digit country code or the name of the country

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if country code or company code is invalid

Examples

>>> from alsi.raw_client import AlsiRawClient
>>> from datetime import datetime
>>> API_KEY='...'
>>> client = AlsiRawClient(api_key=API_KEY)
>>> result = await client.query_data_by_company_and_country(company_code='21X000000001006T', country_code='be', start=datetime(2017, 3, 3))
async query_data_for_facility(facility_code: str, company_code: str, country_code: Union[Area, str], start: Optional[datetime] = None, end: Optional[datetime] = None, limit: Optional[int] = 0) list

Query historical data export for a specific facility from a company within a country

Parameters

facility_codestr

21 digit EIC code of the facility

company_codestr

21 digit EIC code of the company

country_codeUnion[‘Area’, str]

2 digit country code or the name of the country

start: Optional[datetime]

start date

end: Optional[datetime]

end date

limit: Optional[int]

limit the number of results

Raises

TypeError

if country code, company code or facility code is invalid

Examples

>>> from alsi.raw_client import AlsiRawClient
>>> API_KEY='...'
>>> client = AlsiRawClient(api_key=API_KEY)
>>> result = await client.query_data_for_facility(facility_code='18W000000000GVMT', company_code='21X0000000013368', country_code='es*')

alsi.timefilter module

class alsi.timefilter.Timefilter(start, end, limit)

Bases: tuple

property end

Alias for field number 1

property limit

Alias for field number 2

property start

Alias for field number 0

Module contents