Skip to main content

Python API client for Enhydris

Project description


.. image::
:alt: Pypi

.. image::
:alt: Build

.. image::
:alt: Coverage

.. image::
:alt: Updates

Python API client for Enhydris

* Free software: GNU General Public License v3

This package has some functionality to make it easier to use the
Enhydris API.


``pip install enhydris-api-client``



from enhydris_api_client import EnhydrisApiClient

api_client = EnhydrisApiClient("")
api_client.login("joe", "topsecret")

# Get a dict with attrs of station with id=42
station = api_client.get_model(Station, 42)

# Create a new station
api_client.post_model(Station, data={"name": "my station"})



Creates a client. It has the following methods.

**.login(username, password)**

Logins to Enhydris. Raises an exception if unsuccessful.

**.get_model(model, id)**

Returns a dict with the data for the model of type ``model`` (a string such
as "Timeseries" or "Station"), with the given ``id``.

**.post_model(model, data)**

Creates a new model of type ``model`` (a string such as "Timeseries"
or "Station"), with its data given by dictionary ``data``, and
returns its id.

**.delete_model(model, id)**

Deletes the specified model. See ``get_model`` for the parameters.


Retrieves the time series data into a pandas dataframe indexed by date that
it returns.

**.post_tsdata(timeseries_id, ts)**

Posts a time series to Enhydris "api/tsdata", appending the records
to any already existing. ``ts`` is a pandas dataframe indexed by date.


Returns a ``datetime`` object which is the last timestamp of the time
series. If the time series is empty it returns ``None``.


0.1.0 (2019-03-06)

- Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for enhydris-api-client, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size enhydris_api_client-0.1.0-py2.py3-none-any.whl (4.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size enhydris-api-client-0.1.0.tar.gz (6.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page