-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathusers.py
More file actions
34 lines (28 loc) · 1.01 KB
/
users.py
File metadata and controls
34 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
class Users:
def __init__(self, node):
self.node = node
def get(self, user):
response = requests.get(
f'{self.node.url}/users/{user}')
res = response.json()
self.node.check_error(res)
return res.get('data')
def verifications(self, user):
response = requests.get(
f'{self.node.url}/users/{user}/verifications')
res = response.json()
self.node.check_error(res)
return res.get('data').get('verifications')
def connections(self, user, direction):
response = requests.get(
f'{self.node.url}/users/{user}/connections/{direction}')
res = response.json()
self.node.check_error(res)
return res.get('data').get('connections')
def profile(self, user, requestor=""):
response = requests.get(
f'{self.node.url}/users/{user}/profile/{requestor}')
res = response.json()
self.node.check_error(res)
return res.get('data')