fixed /setadmin function

This commit is contained in:
Linus E
2022-04-26 12:21:37 +02:00
parent 42a5ad4a12
commit b347c10653
2 changed files with 9 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ __license__ = "None"
#side-dependencies: none
#Work in Progress
from email import header
import sys
import os
import requests as r
@@ -340,14 +341,14 @@ class API_Handler:
Args:
email (string): email of the user
is_admin (String): "true" if user should be Admin, "false" if not
is_admin (bool): "true" if user should be Admin, "false" if not
Returns:
int: status code
"""
with r.Session() as s:
headers = {'Authorization': 'Bearer ' + self.token} # only bot token is needed, user is chosen by email
req = s.put(self.db_adress + "/user/setAdmin", json={"admin": str(is_admin),"email": str(email)})
req = s.put(self.db_adress + "/user/setAdmin", json={"admin": is_admin,"email": str(email)}, headers=headers)
return req.status_code