wg-backend-django/wg_api/utils/reqs_handler.py

47 lines
891 B
Python
Raw Normal View History

import json
import requests
def get_session():
login_data = {'username':"admin","password":"admin"}
inf_s = requests.Session()
inf_s.post('http://10.30.1.138:5000/login', login_data)
return inf_s
def req_edit_state(id, state):
inf_s = get_session()
if state == "false":
state = False
if state == "true":
state = True
req_val = {"id":id,"status":state}
req_val = json.dumps(req_val)
print("Req Val --> ", req_val)
req = inf_s.post('http://10.30.1.138:5000/client/set-status', req_val)
print(req)
2022-11-30 03:58:16 -05:00
def req_edit_user(id):
inf_s = get_session()
req_val = id
req_url = 'http://10.30.1.138:5000/api/client/'+req_val
req = inf_s.get(req_url)
print("-->")
print(req)
# req = json.loads(req)
return req.json()
#
# http://10.30.1.138:5000/api/client/caivc1vekn84im2m6ec0?_=1669623393468