Download of a DAHITI water level time series from hypsometry
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-hypsometry' | Action of the request |
dahiti_id | e.g. '233' | DAHITI ID |
JSON response from DAHITI server
{
'message': [],
'status': 'OK',
'target': {
'id': '233',
'target_name': 'Siling Co, Lake',
'location': None,
'country': 'China',
'continent': 'Asia',
'latitude': 31.7842,
'longitude': 88.9357,
'points': 208,
'software': 1.0,
'download': '2023-07-06 11:25:50',
'data': [
{
'date': '1988-08-27',
'height': 4534.678,
'error': 1.371
},{
'date': '1989-07-29',
'height': 4534.666,
'error': 0.725
},{
'date': '1989-11-18',
'height': 4534.679,
'error': 2.496
}, ... , {
'date': '2020-12-01',
'height': 4544.31,
'error': 1.35
}
]
}
}
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-hypsometry'
args['dahiti_id'] = '233'
""" 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-water-level-hypsometry&dahiti_id=233" -X POST https://dahiti.dgfi.tum.de/api/v1/