Skip to content

Commit b53e70d

Browse files
update multidatastream get_dao() and small fixes to readme
1 parent e328d68 commit b53e70d

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ identified by a URI.
1515

1616
### CRUD operations
1717
The source code below demonstrates the CRUD operations for Thing objects. Operations for other entities work similarly.
18-
```
18+
```python
1919
import frost_sta_client as fsc
2020

2121
url = "exampleserver.com/FROST-Server/v1.1"
2222
service = fsc.SensorThingsService(url)
2323
```
2424
#### Creating Entities
25-
```
25+
```python
2626
from geojson import Point
2727

2828
point = Point((-115.81, 37.24))
@@ -37,7 +37,7 @@ service.create(thing)
3737
#### Querying Entities
3838
Queries to the FROST Server can be modified to include filters, selections or expansions. The return value is always
3939
an EntityList object, containing the parsed json response of the server.
40-
```
40+
```python
4141
things_list = service.things().query().filter('id eq 1').list()
4242

4343
for thing in things_list:
@@ -50,7 +50,7 @@ replaying to the request with the first chunk accompanied by the link to the nex
5050

5151
The class `EntityList` implements the function `__iter__` and `__next__` which makes it capable of iterating
5252
through the entire list of entities, including the calls to all chunks.
53-
```
53+
```python
5454
things_list = service.things().query().list()
5555

5656
for thing in things_list:
@@ -59,7 +59,7 @@ for thing in things_list:
5959

6060
In a case where only the current chunk is supposed to be iterated, the `entities` list can be used.
6161

62-
```
62+
```python
6363
things_list = service.things().query().top(20).list()
6464

6565
for thing in things_list.entities:
@@ -69,7 +69,7 @@ for thing in things_list.entities:
6969
### Queries to related entity lists
7070

7171
For example the Observations of a given Datastream can be queried via
72-
```
72+
```python
7373
datastream = service.datastreams().find(1)
7474
observations_list = datastream.get_observations().query().filter("result gt 10").list()
7575
```
@@ -84,7 +84,7 @@ combination with a for-loop).
8484

8585
The callback function is called with one argument, which is the current index of the iteration.
8686

87-
```
87+
```python
8888
def callback_func(loaded_entities):
8989
print("loaded {} entities!".format(loaded_entities))
9090

@@ -100,7 +100,7 @@ DataArrays can be used to make the creation of Observations easier, because with
100100
has to be created.
101101

102102
An example usage looks as follows:
103-
```
103+
```python
104104
import frost_sta_client as fsc
105105

106106
service = fsc.SensorThingsService("exampleserver.com/FROST-Server/v1.1")
@@ -111,11 +111,11 @@ An example usage looks as follows:
111111
dav.components = components
112112
dav.datastream = datastream
113113
obs1 = fsc.Observation(result=3,
114-
phenomenon_time='2022-12-19T10:00:00Z',
114+
phenomenon_time='2022-12-19T10:00:00Z/2022-12-19T11:0:0Z',
115115
datastream=datastream,
116116
feature_of_interest=foi)
117117
obs2 = fsc.Observation(result=5,
118-
phenomenon_time='2022-12-19T17:00:00Z',
118+
phenomenon_time='2022-12-19T10:00:00Z/2022-12-19T11:0:0Z',
119119
datastream=datastream,
120120
feature_of_interest=foi)
121121
dav.add_observation(obs1)

frost_sta_client/model/multi_datastream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,5 +345,5 @@ def __setstate__(self, state):
345345
self.observed_properties.next_link = state.get('Observations@iot.nextLink')
346346
self.observed_properties.count = state.get('Observations@iot.count')
347347

348-
def get_dao(self):
349-
return MultiDatastreamDao(self)
348+
def get_dao(self, service):
349+
return MultiDatastreamDao(service)

0 commit comments

Comments
 (0)