Skip to content

Commit 9fb8d58

Browse files
committed
Update methods.py
1 parent bb3ee59 commit 9fb8d58

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

licensing/methods.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,37 @@ def dissociate(token, username):
17801780

17811781
return (jobj, "")
17821782

1783+
@staticmethod
1784+
def get_users(token, customer_id = 0):
1785+
1786+
"""
1787+
List all registered users. Please note that calling this method
1788+
requires a UserAuthAdmin token.
1789+
1790+
More docs: https://app.cryptolens.io/docs/api/v3/GetUsers
1791+
"""
1792+
1793+
try:
1794+
response = HelperMethods.send_request("/userauth/GetUsers/",\
1795+
{"token":token,\
1796+
"customerid":customer_id})
1797+
except HTTPError as e:
1798+
response = e.read()
1799+
except URLError as e:
1800+
return (None, "Could not contact the server. Error message: " + str(e))
1801+
except Exception:
1802+
return (None, "Could not contact the server.")
1803+
1804+
jobj = json.loads(response)
1805+
1806+
if jobj == None or not("result" in jobj) or jobj["result"] == 1:
1807+
if jobj != None:
1808+
return (None, jobj["message"])
1809+
else:
1810+
return (None, "Could not contact the server.")
1811+
1812+
return (jobj["users"], "")
1813+
17831814

17841815
@staticmethod
17851816
def remove_user(token, username):

0 commit comments

Comments
 (0)