Get nearest DAHITI river
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 | 'get-nearest-river' | Action of the request |
longitude | e.g. '11.0' | Longitude |
latitude | e.g. '46.0' | Latitude |
JSON response from DAHITI server
{
'id': 20158,
'longitude': 11.0744,
'latitude': 46.1369,
'distance': 16.287,
'tracks': [
{
'mission': 'sentinel3al_hf',
'pass_nr': '0158'
}
]
}
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'] = 'get-nearest-river'
args['longitude'] = 11.0
args['latitude'] = 46.0
""" 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