NEW API :
* /api2/wgEdit?id=<USER ID>&state=<ENABLED/DISABLED>
This commit is contained in:
BIN
wg_api/utils/__pycache__/html_parser.cpython-311.pyc
Normal file
BIN
wg_api/utils/__pycache__/html_parser.cpython-311.pyc
Normal file
Binary file not shown.
BIN
wg_api/utils/__pycache__/reqs_handler.cpython-311.pyc
Normal file
BIN
wg_api/utils/__pycache__/reqs_handler.cpython-311.pyc
Normal file
Binary file not shown.
BIN
wg_api/utils/__pycache__/statistics.cpython-311.pyc
Normal file
BIN
wg_api/utils/__pycache__/statistics.cpython-311.pyc
Normal file
Binary file not shown.
@@ -151,6 +151,7 @@ def get_profiles():
|
||||
current_data["data_id"]=i
|
||||
final_data.append(current_data)
|
||||
i = i + 1
|
||||
|
||||
final_data = json.dumps(final_data)
|
||||
# print(final_data)
|
||||
|
||||
|
||||
29
wg_api/utils/reqs_handler.py
Normal file
29
wg_api/utils/reqs_handler.py
Normal file
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user