Skip to content

Commit 947ead2

Browse files
committed
added the get_user_api_token method to the API
1 parent eca51b8 commit 947ead2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sdcclient/_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,3 +1113,17 @@ def set_agents_config(self, config):
11131113
def clear_agents_config(self):
11141114
data = {'files' : []}
11151115
self.set_agents_config(data)
1116+
1117+
def get_user_api_token(self, username, teamname):
1118+
res = self.get_team(teamname)
1119+
if res[0] == False:
1120+
return res
1121+
1122+
t = res[1]
1123+
1124+
res = requests.get(self.url + '/api/token/%s/%d' % (username, t['id']), headers=self.hdrs)
1125+
if not self.__checkResponse(res):
1126+
return [False, self.lasterr]
1127+
data = res.json()
1128+
return [True, data['token']['key']]
1129+

0 commit comments

Comments
 (0)