(20250225) Started accepting more fields to the verification API.
This commit is contained in:
@@ -363,6 +363,24 @@ class MikroTikHotspot1000Controller(MikroTikController):
|
|||||||
all_messages.append(f"STEP 8 ({api_response.action}): {api_response.success}")
|
all_messages.append(f"STEP 8 ({api_response.action}): {api_response.success}")
|
||||||
if not api_response.success: all_success = False
|
if not api_response.success: all_success = False
|
||||||
|
|
||||||
|
# STEP 9-A
|
||||||
|
# Set up the Walled-Garden:
|
||||||
|
for index, url in enumerate([
|
||||||
|
"api.thecaoffice.com",
|
||||||
|
"cdn.jsdelivr.net"
|
||||||
|
]):
|
||||||
|
api_response = await mikrotik_client.add_hotspot_walled_garden(
|
||||||
|
json_payload={
|
||||||
|
"action": "allow",
|
||||||
|
"dst-host": url,
|
||||||
|
"comment": HS_COMMENT
|
||||||
|
}
|
||||||
|
)
|
||||||
|
print(f"STEP 9-A.{index}:", api_response.success, f"({api_response.action})")
|
||||||
|
print("MESSAGE:", api_response.message)
|
||||||
|
print("JSON:", api_response.data)
|
||||||
|
print("\n\n")
|
||||||
|
|
||||||
# STEP 9:
|
# STEP 9:
|
||||||
# Set up the Walled-Garden IP:
|
# Set up the Walled-Garden IP:
|
||||||
api_response = await mikrotik_client.add_hotspot_walled_garden_ip(
|
api_response = await mikrotik_client.add_hotspot_walled_garden_ip(
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ sys.path.append(".")
|
|||||||
sys.path.append("..")
|
sys.path.append("..")
|
||||||
|
|
||||||
# For making data models:
|
# For making data models:
|
||||||
from pydantic import BaseModel, Field, field_validator, Extra
|
from pydantic import BaseModel, Field, field_validator, Extra, EmailStr
|
||||||
from typing import Optional, Any, Dict, List
|
from typing import Optional, Any, Dict, List
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
@@ -189,6 +189,10 @@ class VerifyTimedOTPRequestData(BaseModel):
|
|||||||
|
|
||||||
id: str | Dict | List
|
id: str | Dict | List
|
||||||
otp: str
|
otp: str
|
||||||
|
username: str
|
||||||
|
password: str
|
||||||
|
email: EmailStr
|
||||||
|
phoneNo: str
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
extra = "forbid"
|
extra = "forbid"
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ sys.path.append(".")
|
|||||||
sys.path.append("..")
|
sys.path.append("..")
|
||||||
|
|
||||||
# For making data models:
|
# For making data models:
|
||||||
from pydantic import BaseModel, Field, field_validator, Extra
|
from pydantic import BaseModel, Field, field_validator, Extra, EmailStr
|
||||||
from typing import Optional, Any, Dict, List
|
from typing import Optional, Any, Dict, List
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user