@@ 43-54 (lines=12) @@ | ||
40 | self.path, kwargs).json() |
|
41 | ||
42 | def set_password(self, new_password): |
|
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 |
@@ 28-39 (lines=12) @@ | ||
25 | }) |
|
26 | ||
27 | Note that the schema must be encoded as a string when creating in this format. |
|
28 | """ |
|
29 | kwargs["public"] = public |
|
30 | self.metadata = self.db.create(self.path, kwargs).json() |
|
31 | ||
32 | def streams(self): |
|
33 | """Returns the list of streams that belong to the device""" |
|
34 | result = self.db.read(self.path, {"q": "ls"}) |
|
35 | ||
36 | if result is None or result.json() is None: |
|
37 | return [] |
|
38 | streams = [] |
|
39 | for s in result.json(): |
|
40 | strm = self[s["name"]] |
|
41 | strm.metadata = s |
|
42 | streams.append(strm) |