Skip to main content

Facilitate access to Demeter REST interface endpoints, provided by Hidroconta S.A.U.

Project description

Integrations-PythonAPI

Python API to facilitate access to Demeter REST interface endpoints. https://pypi.org/project/hidroconta/

Current version: 1.8.0 (18/11/2025)

Added:

# 1.6.0:
# Added historical type FlowHist
# Added historical type CustomHist to add a custom subtype and subcode

# 1.6.1
# Fixed FlowHist, named FlowlHist in 1.6.0

# 1.7.0
# Added IrisCounterGlobalHist to types 

# 1.7.1
# Fixed error in get_criteria

# 1.8.0
# Fixed history consumption endpoint to work with legacy values

# 2.0.0
# Added Nautilus+ compatibility

The API allows the management of large amounts of data using the Pandas library, provided that the following directive is used in method calls:

# Pandas = True returns a pandas dataframe instead a json

The way to use the API is the following:

  • Import the desired modules:
import hidroconta.api as demeter
import hidroconta.types as hidrotypes
import pandas as pd
import datetime
import hidroconta.endpoints as hidroendpoints
  • Select the server with which you want to communicate (you can modify it at any time):
# Set server
demeter.set_server(hydroendpoints.Server.MAIN)
  • Login to this server
# Login
demeter.login('USERNAME', 'PASSWORD')

Once the previous steps have been followed, you can make any query about the system. Some of them are:

  • Search
# Search
df = demeter.search(text='SAT', element_types=[hidrotypes.Element.COUNTER, hidrotypes.Element.ANALOG_INPUT, hidrotypes.Element.RTU], status=hidrotypes.Status.ENABLED, pandas=True)
print(df)
  • Getting history
# Get historics
df = demeter.get_historics(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), element_ids=[1000], subtype=hidrotypes.AnalogInputHist.subtype, subcode=[hidrotypes.AnalogInputHist.subcode], pandas=True)
print(df)
  • Getting elements
# Get
df = demeter.get_rtus(element_id=17512, pandas=True)
print(df)

The API also defines a special exception when the call to the Demeter endpoint does not return the expected result. The exception is called 'DemeterStatusCodeException' and contains the HTTP error code.

# Exception treatment
try:
    df = demeter.get_rtus(element_id=17512, pandas=True).
except demeter.DemeterStatusCodeException as status_code:
    print('Error {}'.format(status_code))
  • Finally, a logout should be made on the server
demeter.logout()

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

hidroconta-2.0.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hidroconta-2.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file hidroconta-2.0.0.tar.gz.

File metadata

  • Download URL: hidroconta-2.0.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.2

File hashes

Hashes for hidroconta-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1d10bf451bab8ce1ab16808f43d7f4cad05f4ccbd4a3e8ba2adf72b1828a2355
MD5 61236581e05eb6dcb332d8a9e0589684
BLAKE2b-256 900fd2f07a604e2b37b08fce41b998a4507dc3b2e22f422a4ff224b06039c732

See more details on using hashes here.

File details

Details for the file hidroconta-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: hidroconta-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.2

File hashes

Hashes for hidroconta-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83cf5ec4ed25ecec1906202cc99ee0ff50e916b5a529f30dcd0104ef1035c263
MD5 1a076f490fdbab63b3c3f60ec6ad7542
BLAKE2b-256 961858f9016cc03aafd02f3374124eea56a2bdf7ac2b2ce7984444eb5de5a329

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