frost-sta-client 1.1.46__tar.gz → 1.1.49__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/PKG-INFO +3 -2
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/README.md +1 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/__version__.py +2 -2
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/utils.py +122 -119
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client.egg-info/PKG-INFO +3 -2
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/LICENSE +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/__init__.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/__init__.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/actuator.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/base.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/datastream.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/features_of_interest.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/historical_location.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/location.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/multi_datastream.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/observation.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/observedproperty.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/sensor.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/task.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/tasking_capability.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/thing.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/__init__.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/actuator.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/datastream.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/entity.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/__init__.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/data_array_document.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/data_array_value.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/entity_list.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/entity_type.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/unitofmeasurement.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/feature_of_interest.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/historical_location.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/location.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/multi_datastream.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/observation.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/observedproperty.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/sensor.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/task.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/tasking_capability.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/thing.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/query/__init__.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/query/query.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/service/__init__.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/service/auth_handler.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/service/sensorthingsservice.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client.egg-info/SOURCES.txt +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client.egg-info/dependency_links.txt +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client.egg-info/requires.txt +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client.egg-info/top_level.txt +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/setup.cfg +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/setup.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/tests/test_entity_formatter.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/tests/test_entity_reader.py +0 -0
- {frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/tests/test_utils.py +0 -0
@@ -1,10 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: frost_sta_client
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.49
|
4
4
|
Summary: a client library to facilitate interaction with a FROST SensorThingsAPI Server
|
5
5
|
Home-page: https://github.com/FraunhoferIOSB/FROST-Python-Client
|
6
6
|
Author: Fraunhofer IOSB
|
7
|
-
Author-email:
|
7
|
+
Author-email: frost@iosb.fraunhofer.de
|
8
8
|
License: LGPL3
|
9
9
|
Keywords: sta,ogc,frost,sensorthingsapi,IoT
|
10
10
|
Description-Content-Type: text/markdown
|
@@ -104,6 +104,7 @@ observations_list = datastream.get_observations().query().filter("result gt 10")
|
|
104
104
|
```
|
105
105
|
|
106
106
|
### Callback function in `EntityList`
|
107
|
+
|
107
108
|
The progress of the loading process can be tracked by supplying a callback function along with a step size. The callback
|
108
109
|
function and the step size must both be provided to the `list` function (see example below).
|
109
110
|
|
@@ -75,6 +75,7 @@ observations_list = datastream.get_observations().query().filter("result gt 10")
|
|
75
75
|
```
|
76
76
|
|
77
77
|
### Callback function in `EntityList`
|
78
|
+
|
78
79
|
The progress of the loading process can be tracked by supplying a callback function along with a step size. The callback
|
79
80
|
function and the step size must both be provided to the `list` function (see example below).
|
80
81
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
__title__ = 'frost_sta_client'
|
2
|
-
__version__ = '1.1.
|
2
|
+
__version__ = '1.1.49'
|
3
3
|
__license__ = 'LGPL3'
|
4
4
|
__author__ = 'Fraunhofer IOSB'
|
5
5
|
__copyright__ = 'Fraunhofer IOSB'
|
6
|
-
__contact__ = '
|
6
|
+
__contact__ = 'frost@iosb.fraunhofer.de'
|
7
7
|
__url__ = 'https://github.com/FraunhoferIOSB/FROST-Python-Client'
|
8
8
|
__description__ = 'a client library to facilitate interaction with a FROST SensorThingsAPI Server'
|
@@ -1,119 +1,122 @@
|
|
1
|
-
# Copyright (C) 2021 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131
|
2
|
-
# Karlsruhe, Germany.
|
3
|
-
#
|
4
|
-
# This program is free software: you can redistribute it and/or modify
|
5
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
6
|
-
# the Free Software Foundation, either version 3 of the License, or
|
7
|
-
# (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU Lesser General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU Lesser General Public License
|
15
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
-
|
17
|
-
import jsonpickle
|
18
|
-
import datetime
|
19
|
-
from dateutil.parser import isoparse
|
20
|
-
import geojson
|
21
|
-
import logging
|
22
|
-
import sys
|
23
|
-
import frost_sta_client.model.ext.entity_list
|
24
|
-
|
25
|
-
|
26
|
-
def extract_value(location):
|
27
|
-
try:
|
28
|
-
value = int(location[location.find('(')+1: location.find(')')])
|
29
|
-
except ValueError:
|
30
|
-
value = str(location[location.find('(')+2: location.find(')')-1])
|
31
|
-
return value
|
32
|
-
|
33
|
-
def transform_entity_to_json_dict(entity):
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
1
|
+
# Copyright (C) 2021 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131
|
2
|
+
# Karlsruhe, Germany.
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
import jsonpickle
|
18
|
+
import datetime
|
19
|
+
from dateutil.parser import isoparse
|
20
|
+
import geojson
|
21
|
+
import logging
|
22
|
+
import sys
|
23
|
+
import frost_sta_client.model.ext.entity_list
|
24
|
+
|
25
|
+
|
26
|
+
def extract_value(location):
|
27
|
+
try:
|
28
|
+
value = int(location[location.find('(')+1: location.find(')')])
|
29
|
+
except ValueError:
|
30
|
+
value = str(location[location.find('(')+2: location.find(')')-1])
|
31
|
+
return value
|
32
|
+
|
33
|
+
def transform_entity_to_json_dict(entity):
|
34
|
+
try:
|
35
|
+
data = entity.__getstate__()
|
36
|
+
except AttributeError:
|
37
|
+
data = entity.__dict__
|
38
|
+
return data
|
39
|
+
|
40
|
+
def class_from_string(string):
|
41
|
+
module_name, class_name = string.rsplit(".", 1)
|
42
|
+
return getattr(sys.modules[module_name], class_name)
|
43
|
+
|
44
|
+
def transform_json_to_entity(json_response, entity_class):
|
45
|
+
cl = class_from_string(entity_class)
|
46
|
+
obj = cl()
|
47
|
+
obj.__setstate__(json_response)
|
48
|
+
return obj
|
49
|
+
|
50
|
+
def transform_json_to_entity_list(json_response, entity_class):
|
51
|
+
entity_list = frost_sta_client.model.ext.entity_list.EntityList(entity_class)
|
52
|
+
result_list = []
|
53
|
+
if isinstance(json_response, dict):
|
54
|
+
try:
|
55
|
+
response_list = json_response['value']
|
56
|
+
entity_list.next_link = json_response.get("@iot.nextLink", None)
|
57
|
+
entity_list.count = json_response.get("@iot.count", None)
|
58
|
+
except AttributeError as e:
|
59
|
+
raise e
|
60
|
+
elif isinstance(json_response, list):
|
61
|
+
response_list = json_response
|
62
|
+
else:
|
63
|
+
raise ValueError("expected json as a dict or list to transform into entity list")
|
64
|
+
entity_list.entities = [transform_json_to_entity(item, entity_list.entity_class) for item in response_list]
|
65
|
+
return entity_list
|
66
|
+
|
67
|
+
|
68
|
+
def check_datetime(value, time_entity):
|
69
|
+
try:
|
70
|
+
parse_datetime(value)
|
71
|
+
except ValueError as e:
|
72
|
+
logging.error(f"error during {time_entity} check")
|
73
|
+
raise e
|
74
|
+
return value
|
75
|
+
|
76
|
+
|
77
|
+
def parse_datetime(value) -> str:
|
78
|
+
if value is None:
|
79
|
+
return value
|
80
|
+
if isinstance(value, str):
|
81
|
+
if '/' in value:
|
82
|
+
try:
|
83
|
+
times = value.split('/')
|
84
|
+
if len(times) != 2:
|
85
|
+
raise ValueError("If the time interval is provided as a string,"
|
86
|
+
" it should be in isoformat")
|
87
|
+
result = [isoparse(times[0]),
|
88
|
+
isoparse(times[1])]
|
89
|
+
except ValueError:
|
90
|
+
raise ValueError("If the time entity interval is provided as a string,"
|
91
|
+
" it should be in isoformat")
|
92
|
+
result = result[0].isoformat() + '/' + result[1].isoformat()
|
93
|
+
return result
|
94
|
+
else:
|
95
|
+
try:
|
96
|
+
result = isoparse(value)
|
97
|
+
except ValueError:
|
98
|
+
raise ValueError("If the phenomenon time is provided as string, it should be in isoformat")
|
99
|
+
result = result.isoformat()
|
100
|
+
return result
|
101
|
+
if isinstance(value, datetime.datetime):
|
102
|
+
return value.isoformat()
|
103
|
+
if isinstance(value, list) and all(isinstance(v, datetime.datetime) for v in value):
|
104
|
+
return value[0].isoformat() + value[1].isoformat()
|
105
|
+
else:
|
106
|
+
raise ValueError('time entities should consist of one or two datetimes')
|
107
|
+
|
108
|
+
|
109
|
+
def process_area(value):
|
110
|
+
if not isinstance(value, dict):
|
111
|
+
raise ValueError("geojsons can only be handled as dictionaries!")
|
112
|
+
if value.get("type", None) is None or value.get("coordinates", None) is None:
|
113
|
+
raise ValueError("Both type and coordinates need to be specified in the dictionary")
|
114
|
+
if value["type"] == "Point":
|
115
|
+
return geojson.geometry.Point(value["coordinates"])
|
116
|
+
if value["type"] == "Polygon":
|
117
|
+
return geojson.geometry.Polygon(value["coordinates"])
|
118
|
+
if value["type"] == "Geometry":
|
119
|
+
return geojson.geometry.Geometry(value["coordinates"])
|
120
|
+
if value["type"] == "LineString":
|
121
|
+
return geojson.geometry.LineString(value["coordinates"])
|
122
|
+
raise ValueError("can only handle geojson of type Point, Polygon, Geometry or LineString")
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: frost_sta_client
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.49
|
4
4
|
Summary: a client library to facilitate interaction with a FROST SensorThingsAPI Server
|
5
5
|
Home-page: https://github.com/FraunhoferIOSB/FROST-Python-Client
|
6
6
|
Author: Fraunhofer IOSB
|
7
|
-
Author-email:
|
7
|
+
Author-email: frost@iosb.fraunhofer.de
|
8
8
|
License: LGPL3
|
9
9
|
Keywords: sta,ogc,frost,sensorthingsapi,IoT
|
10
10
|
Description-Content-Type: text/markdown
|
@@ -104,6 +104,7 @@ observations_list = datastream.get_observations().query().filter("result gt 10")
|
|
104
104
|
```
|
105
105
|
|
106
106
|
### Callback function in `EntityList`
|
107
|
+
|
107
108
|
The progress of the loading process can be tracked by supplying a callback function along with a step size. The callback
|
108
109
|
function and the step size must both be provided to the `list` function (see example below).
|
109
110
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/features_of_interest.py
RENAMED
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/historical_location.py
RENAMED
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/multi_datastream.py
RENAMED
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/observedproperty.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/dao/tasking_capability.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/data_array_value.py
RENAMED
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/entity_list.py
RENAMED
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/entity_type.py
RENAMED
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/ext/unitofmeasurement.py
RENAMED
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/feature_of_interest.py
RENAMED
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/historical_location.py
RENAMED
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/multi_datastream.py
RENAMED
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/observedproperty.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/model/tasking_capability.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/service/auth_handler.py
RENAMED
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client/service/sensorthingsservice.py
RENAMED
File without changes
|
File without changes
|
{frost_sta_client-1.1.46 → frost_sta_client-1.1.49}/frost_sta_client.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|