Skip to content

Commit 2ade820

Browse files
authored
Merge pull request #2 from PooyaFekri/api_5.7.0
add groups
2 parents bf417c4 + 0dc5c51 commit 2ade820

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

brightid/groups.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import requests
2+
3+
class Groups:
4+
def __init__(self, node):
5+
self.node = node
6+
7+
def get(self, group):
8+
response = requests.get(
9+
f'{self.node.url}/groups/{group}')
10+
res = response.json()
11+
self.node.check_error(res)
12+
return res.get('data')

brightid/node.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import requests
22

3-
from . import users, operations, verifications, testblocks, apps
3+
from . import users, groups, operations, verifications, testblocks, apps
44

55

66
class Node:
77
def __init__(self, url='http://node.brightid.org/brightid/v5'):
88
self.url = url
99
self.users = users.Users(self)
10+
self.groups = groups.Groups(self)
1011
self.operations = operations.Operations(self)
1112
self.verifications = verifications.Verifications(self)
1213
self.testblocks = testblocks.Testblocks(self)
1314
self.apps = apps.Apps(self)
15+
1416
def ip(self):
1517
response = requests.get(f'{self.url}/ip')
1618
res = response.json()
@@ -25,4 +27,4 @@ def state(self):
2527

2628
def check_error(self, res):
2729
if res.get('error'):
28-
raise RuntimeError(res.get('errorMessage'))
30+
raise RuntimeError(res.get('errorMessage'))

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
setup(
33
name = 'python_brightid',
44
packages = ['brightid'],
5-
version = '1.1.5',
5+
version = '1.2.0',
66
license='MIT',
77
description = 'SDK for integrating with BrightId!',
88
author = 'Pooya Fekri',

0 commit comments

Comments
 (0)