Package: enhydris-api-client
enhydris-api-clientPython API client for EnhydrisFree software: GNU General Public License v3This package has some functionality to make it easier to use the
Enhydris API.Installationpip installenhydris-api-clientExamplefrom enhydris_api_client import EnhydrisApiClient

with EnhydrisApiClient("https://openmeteo.org", "my_auth_token") as api_client:
    # 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"})ReferenceEnhydrisApiClient(base_url, token=None)Creates and returns an api client. It can also be used as a context
manager, though this is not necessary. If not used as a context manager,
you might get warnings about unclosed sockets.Not specifyingtokenis deprecated.tokenwill become mandatory
in future versions.EnhydrisApiClientobjects have the following methods:.get_token(username, password)(Deprecated.) Gets an API token from Enhydris and thereafter uses it in
subsequent requests. The method will be removed in future versions..get_station(id).post_station(data).put_station(station_id, data).patch_station(station_id, data).delete_station(station_id)Methods that create, retrieve, update or delete stations. Thedataargument (for those methods that receive one) is a dictionary.get_station()returns a dictionary with the data for the station.post_station()returns the created station’s id..get_timeseries_group(station_id, timeseries_group_id).post_timeseries_group(station_id, timeseries_group_id, data).put_timeseries_group(station_id, timeseries_group_id, data).patch_timeseries_group(station_id, timeseries_group_id, data).delete_timeseries_group(station_id, timeseries_group_id)Methods that create, retrieve, update or delete time series groups.
Similar to the ones for station..list_timeseries(station_id, timeseries_group_id).get_timeseries(station_id, timeseries_group_id, timeseries_id).post_timeseries(station_id, timeseries_group_id, data).delete_timeseries(station_id, timeseries_group_id, timeseries_id)Methods that create, retrieve or delete time series. Similar to the ones
for station.list_timeseries()returns a list of dictionaries..read_tsdata(station_id, timeseries_group_id, timeseries_id, start_date=None, end_date=None, timezone=”UTC”).post_tsdata(station_id, timeseries_group_id, timeseries_id, ts).get_ts_end_date(station_id, timeseries_group_id, timeseries_id, timezone=”UTC”)Methods that retrieve or update time series data.read_ts_data()retrieves the time series data into a htimeseries
object that it returns. Ifstart_dateand/orend_date(aware
datetime objects) are specified, only the part of the time series
between these dates is retrieved. The timestamps are returned in the
specified time zone.post_tsdata() `` posts a time series to Enhydris, appending the records to any already existing.  ``tsis a htimeseries object.get_ts_end_date()returns adatetimeobject which is the last
timestamp of the time series. If the time series is empty it returnsNone. The returned timestamp is always naive, but it is in the specifiedtimezone.History3.0.0 (2022-12-04)Requires Enhydris 4 and htimeseries 4, and therefore requires aware
HTimeseries objects.Requires specifying time zone when downloading time series data.Support for creating, retrieving, updating, and deleting time series
groups.2.0.1 (2021-08-31)Updated dependences (the version of htimeseries required was too old).2.0.0 (2020-10-06)We now support the time series groups of Enhydris 3. Earlier Enhydris
versions are unsupported. Use enhydris-api-client v1 for Enhydris v2.We now use token authentication. Using a username and password have
been deprecated and will be removed in a future version. Accordingly,
the.login()method has been removed; it has been replaced with
the deprecated.get_token()method.1.0.0 (2020-02-28)We now support only Python 3.7 or greater.If there is an http error, the error message now includes the response body.0.5.1 (2020-01-05)Minor fix for compatibility with htimeseries 20.5.0 (2019-06-13)Can now be used as a context managerAdded post/put/patch/delete station0.4.1 (2019-06-12)Fixed bug where .read_tsdata() was failing to set the metadata
attributes of the time series.0.4.0 (2019-06-12).read_tsdata() now accepts optional arguments start_date and end_date.0.3.0 (2019-06-06)Upgrade dependecy htimeseries to 1.00.2.0 (2019-04-17)Support new API of Enhydris 30.1.0 (2019-03-06)Initial release