@@ 46-57 (lines=12) @@ | ||
43 | """Sets a new password for the user""" |
|
44 | self.set({"password": new_password}) |
|
45 | ||
46 | def devices(self): |
|
47 | """Returns the list of devices that belong to the user""" |
|
48 | result = self.db.read(self.path, {"q": "ls"}) |
|
49 | ||
50 | if result is None or result.json() is None: |
|
51 | return [] |
|
52 | devices = [] |
|
53 | for d in result.json(): |
|
54 | dev = self[d["name"]] |
|
55 | dev.metadata = d |
|
56 | devices.append(dev) |
|
57 | return devices |
|
58 | ||
59 | def streams(self, public=False, downlink=False, visible=True): |
|
60 | """Returns the list of streams that belong to the user. |
@@ 33-44 (lines=12) @@ | ||
30 | kwargs["public"] = public |
|
31 | self.metadata = self.db.create(self.path, kwargs).json() |
|
32 | ||
33 | def streams(self): |
|
34 | """Returns the list of streams that belong to the device""" |
|
35 | result = self.db.read(self.path, {"q": "ls"}) |
|
36 | ||
37 | if result is None or result.json() is None: |
|
38 | return [] |
|
39 | streams = [] |
|
40 | for s in result.json(): |
|
41 | strm = self[s["name"]] |
|
42 | strm.metadata = s |
|
43 | streams.append(strm) |
|
44 | return streams |
|
45 | ||
46 | def __getitem__(self, stream_name): |
|
47 | """Gets the child stream by name""" |