Python API client for Enhydris
Project description
===================
enhydris-api-client
===================
.. image:: https://img.shields.io/pypi/v/enhydris_api_client.svg
:target: https://pypi.python.org/pypi/enhydris-api-client
:alt: Pypi
.. image:: https://img.shields.io/travis/openmeteo/enhydris-api-client.svg
:target: https://travis-ci.org/openmeteo/enhydris-api-client
:alt: Build
.. image:: https://codecov.io/github/openmeteo/enhydris-api-client/coverage.svg
:target: https://codecov.io/gh/openmeteo/enhydris-api-client
:alt: Coverage
.. image:: https://pyup.io/repos/github/openmeteo/enhydris-api-client/shield.svg
:target: https://pyup.io/repos/github/openmeteo/enhydris-api-client/
: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.
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)**
Retrieves the time series data into a htimeseries object that it
returns.
**.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.2.0 (2019-04-17)
------------------
- Support new API of Enhydris 3
0.1.0 (2019-03-06)
------------------
- Initial release
enhydris-api-client
===================
.. image:: https://img.shields.io/pypi/v/enhydris_api_client.svg
:target: https://pypi.python.org/pypi/enhydris-api-client
:alt: Pypi
.. image:: https://img.shields.io/travis/openmeteo/enhydris-api-client.svg
:target: https://travis-ci.org/openmeteo/enhydris-api-client
:alt: Build
.. image:: https://codecov.io/github/openmeteo/enhydris-api-client/coverage.svg
:target: https://codecov.io/gh/openmeteo/enhydris-api-client
:alt: Coverage
.. image:: https://pyup.io/repos/github/openmeteo/enhydris-api-client/shield.svg
:target: https://pyup.io/repos/github/openmeteo/enhydris-api-client/
: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.
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)**
Retrieves the time series data into a htimeseries object that it
returns.
**.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.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 Distribution
Built Distribution
Close
Hashes for enhydris-api-client-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0dfc5bc34fe4305c170bea152b90bacbb880b21040e352f4a92ca89a5aaeb4b |
|
MD5 | c993938752d16a53cd1d77a0b2a4b2e6 |
|
BLAKE2b-256 | 2810f4ba5a666366743da393bd351bf548b9835936bad6be32225cc7b1b5b208 |
Close
Hashes for enhydris_api_client-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04dab7488236b6459a97ae5160dfcf293aba1667a38b7c52713bb082b12c9d9c |
|
MD5 | 1e598a92b784137f85af63257f5847fe |
|
BLAKE2b-256 | 23ae328e54856f13b1923fadc16c94e416f940ff2581754d004e718f50e6225d |