api plus propre
This commit is contained in:
parent
f902031871
commit
e644257040
1 changed files with 6 additions and 14 deletions
20
auth.py
20
auth.py
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue