api plus propre

This commit is contained in:
chapeau 2021-10-25 20:08:54 +02:00
parent f902031871
commit e644257040

20
auth.py
View file

@ -151,10 +151,9 @@ def authorize(data):
# Get all required objects from API
data_from_api = api_client().view(
"radius/authorize/{0}/{1}/{2}".format(
"radius/authorize/{0}/{1}".format(
urllib.parse.quote(nas or "None", safe=""),
urllib.parse.quote(username or "None", safe=""),
urllib.parse.quote(mac or "None", safe="")
))
nas_type = data_from_api["nas"]
@ -188,25 +187,18 @@ def post_auth(data):
# Get all required objects from API
data_from_api = api_client().view(
"radius/post_auth/{0}/{1}/{2}".format(
"radius/post_auth/{0}/{1}/{2}/{3}".format(
urllib.parse.quote(nas or "None", safe=""),
urllib.parse.quote(nas_port or "None", safe=""),
urllib.parse.quote(mac or "None", safe="")
))
data_from_api2 = api_client().view(
"radius/authorize/{0}/{1}/{2}".format(
urllib.parse.quote(nas or "None", safe=""),
urllib.parse.quote(username or "None", safe=""),
urllib.parse.quote(mac or "None", safe="")
urllib.parse.quote(mac or "None", safe=""),
urllib.parse.quote(username or "None", safe="")
))
nas_type = data_from_api["nas"]
port = data_from_api["port"]
switch = data_from_api["switch"]
nas_type = data_from_api2["nas"]
user = data_from_api2["user"]
user_interface = data_from_api2["user_interface"]
user = data_from_api["user"]
user_interface = data_from_api["user_interface"]
# If proxified request
if not nas_type: