update user
This commit is contained in:
@@ -8,6 +8,7 @@ from layercake.strutils import random_str
|
||||
|
||||
from config import KONVIVA_API_URL, KONVIVA_SECRET_KEY
|
||||
|
||||
ADM = 1
|
||||
ALU = 2
|
||||
GES = 3
|
||||
|
||||
@@ -80,6 +81,30 @@ def create_user(
|
||||
return r.json().get('IDUsuario')
|
||||
|
||||
|
||||
def update_user(id: str, **kwargs) -> dict:
|
||||
url = urlparse(KONVIVA_API_URL)._replace(
|
||||
path='/action/api/integrarUsuario',
|
||||
query='sendMail=false',
|
||||
)
|
||||
|
||||
r = requests.put(
|
||||
url=url.geturl(),
|
||||
headers=headers,
|
||||
json={
|
||||
'IDUsuario': int(id),
|
||||
**kwargs,
|
||||
},
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
# Because Konviva does not return the proper HTTP status code
|
||||
if err := glom(r.json(), 'errors', default=None):
|
||||
err = err[0] if isinstance(err, list) else err
|
||||
raise KonvivaError(err)
|
||||
|
||||
return r.json()
|
||||
|
||||
|
||||
def get_users_by_email(email: str) -> list[dict]:
|
||||
url = urlparse(KONVIVA_API_URL)._replace(
|
||||
path='/action/api/getUsuariosByQuery',
|
||||
|
||||
Reference in New Issue
Block a user