HIC get_timeseries_list request not working
Closed this issue · 3 comments
JoniDH commented
- pywaterinfo version: 0.4.0
- Python version: 3.8
- Operating System: Windows 10 Enterprise
Description
I tried to get an overview of the locations with daily HIC depth measurements.
What I Did
H_stations_hic = hic.get_timeseries_list(parametertype_name='H', ts_name = 'DagGem')
Traceback (most recent call last):
File "<ipython-input-17-e7a6f63b481b>", line 1, in <module>
H_stations_hic = hic.get_timeseries_list(parametertype_name='H', ts_name = 'DagGem')
File "~\Anaconda3\lib\site-packages\pywaterinfo\waterinfo.py", line 825, in get_timeseries_list
data, response = self.request_kiwis(query_param)
File "~\Anaconda3\lib\site-packages\pywaterinfo\waterinfo.py", line 221, in request_kiwis
parsed = res.json()
File "~\Anaconda3\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "~\Anaconda3\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "~\Anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "~\Anaconda3\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
JSONDecodeError: Invalid control character at
johanvdw commented
It looks like the server is improperly escaping special characters. This is most likely not a bug in pywaterinfo but in the Kisters software.
As these special characters appear in comments, you can still fetch the list of timeseries by specifying which variables you are interested in, eg:
H_stations_hic = hic.get_timeseries_list(parametertype_name='H', ts_name = 'DagGem', returnfields="ts_id,station_name,stationparameter_longname,station_local_x,station_local_y")
see https://hicws.vlaanderen.be/KiWIS/KiWIS?service=kisters&type=queryServices&request=getRequestInfo for an overview of possible variables.
stijnvanhoey commented
@JoniDH does this work and were you able to extract the data?