Python API client for Enhydris
Project description
enhydris-api-client
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.
Installation
pip install enhydris-api-client
Example
from enhydris_api_client import EnhydrisApiClient api_client = EnhydrisApiClient("https://openmeteo.org") 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"})
Reference
EnhydrisApiClient(base_url)
Creates a client. It has the following methods.
.login(username, password)
Logins to Enhydris. Raises an exception if unsuccessful.
.get_station(id)
Returns a dict with the data for the station with the given id.
.get_timeseries(station_id, timeseries_id)
Returns a dict with the data for the given time series.
.post_timeseries(station_id, data)
Creates a new time series, with its data given by dictionary data, and returns its id.
.delete_timeseries(station_id, timeseries_id)
Deletes the specified time series.
.read_tsdata(station_id, timeseries_id, start_date=None, end_date=None)
Retrieves the time series data into a htimeseries object that it returns. If start_date and/or end_date are specified, only the part of the time series between these dates is retrieved.
.post_tsdata(station_id, timeseries_id, ts)
Posts a time series to Enhydris, appending the records to any already existing. ts is a htimeseries object.
.get_ts_end_date(station_id, timeseries_id)
Returns a datetime object which is the last timestamp of the time series. If the time series is empty it returns None.
History
0.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.0
0.2.0 (2019-04-17)
Support new API of Enhydris 3
0.1.0 (2019-03-06)
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for enhydris_api_client-0.4.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bf8061255a4ed70ac2e1e7e3a03dd666f8e622258508afb0b6431690e225454 |
|
MD5 | 1f99783ce5a1e82ca1cf9141536adff9 |
|
BLAKE2b-256 | 0ac154fda3e6418bba8d5d1326cf2666ac6d198e260f7e7af5bcc1af8e1687d9 |