-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnode.py
More file actions
24 lines (19 loc) · 758 Bytes
/
node.py
File metadata and controls
24 lines (19 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
from . import users, groups, operations, verifications, testblocks, apps
class Node:
def __init__(self):
self.url = "http://node.brightid.org/brightid/v6"
self.users = users.Users(self)
self.groups = groups.Groups(self)
self.operations = operations.Operations(self)
self.verifications = verifications.Verifications(self)
self.testblocks = testblocks.Testblocks(self)
self.apps = apps.Apps(self)
def state(self):
response = requests.get(f'{self.url}/state')
res = response.json()
self.check_error(res)
return res.get('data')
def check_error(self, res):
if res.get('error'):
raise RuntimeError(res.get('errorMessage'))