Download of a DAHITI water level time series
DAHITI-API arguments
Argument | Value | Description |
username | e.g. 'username' | Username to login on the DAHITI website |
password | e.g. 'password' | Password to login on the DAHITI website |
action | 'download-water-level' | Action of the request |
dahiti_id | e.g. '85' | DAHITI ID |
JSON response from DAHITI server
[
{
'date': '2002-07-10',
'height': 621.794,
'error': 0.007
'data_type': 'OP'
},{
'date': '2002-07-12',
'height': 621.704,
'error': 0.0007
'data_type': 'OP'
}, ..., {
'date': '2021-02-20',
'height': 624.570,
'error': 0.0016,
'data_type': 'OP'
},{
'date': '2021-03-02',
'height': 624.589,
'error': 0.0006,
'data_type': 'OP'
}
]
import requests
import json
import pprint
url = 'https://dahiti.dgfi.tum.de/api/v1/'
args = {}
""" required options """
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'download-water-level'
args['dahiti_id'] = '85'
""" send request as method POST """
response = requests.post(url, data=args)
if response.status_code == 200:
""" convert json string in python list """
data = json.loads(response.text)
pprint.pprint(data)
else:
print response.status_code
curl --data "username=username&password=password&action=download&dahiti_id=85" -X POST https://dahiti.dgfi.tum.de/api/v1/