Форматирование всего серверного кода по стандартам (black)
This commit is contained in:
parent
e61ffd793c
commit
06a5a758a3
28 changed files with 611 additions and 305 deletions
|
|
@ -8,6 +8,7 @@ from services.wifi_service import WifiService
|
|||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/scan", response_model=SubnetScanResult)
|
||||
def scan_subnet(subnet: str = "192.168.1.0/24", ports: List[int] = None):
|
||||
"""Сканирует локальную подсеть и возвращает данные об устройствах"""
|
||||
|
|
@ -18,6 +19,7 @@ def scan_subnet(subnet: str = "192.168.1.0/24", ports: List[int] = None):
|
|||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"Ошибка сканирования: {str(e)}")
|
||||
|
||||
|
||||
@router.get("/wifi", response_model=WifiScanResult)
|
||||
def scan_wifi(timeout: int = 30):
|
||||
"""Сканирует Wi-Fi точки доступа и возвращает данные о них"""
|
||||
|
|
@ -26,7 +28,10 @@ def scan_wifi(timeout: int = 30):
|
|||
result = wifi_service.scan_wifi(timeout=timeout)
|
||||
return result
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"Ошибка сканирования Wi-Fi: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Ошибка сканирования Wi-Fi: {str(e)}"
|
||||
)
|
||||
|
||||
|
||||
@router.post("/devices/{mac}/note")
|
||||
def add_note(mac: str, request: NoteRequest):
|
||||
|
|
@ -43,7 +48,10 @@ def add_note(mac: str, request: NoteRequest):
|
|||
except HTTPException as e:
|
||||
raise e
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"Ошибка добавления заметки: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Ошибка добавления заметки: {str(e)}"
|
||||
)
|
||||
|
||||
|
||||
@router.put("/devices/{mac}/note")
|
||||
def update_note(mac: str, request: NoteRequest):
|
||||
|
|
@ -60,7 +68,10 @@ def update_note(mac: str, request: NoteRequest):
|
|||
except HTTPException as e:
|
||||
raise e
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"Ошибка обновления заметки: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Ошибка обновления заметки: {str(e)}"
|
||||
)
|
||||
|
||||
|
||||
@router.delete("/devices/{mac}/note")
|
||||
def delete_note(mac: str):
|
||||
|
|
@ -77,4 +88,6 @@ def delete_note(mac: str):
|
|||
except HTTPException as e:
|
||||
raise e
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"Ошибка удаления заметки: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Ошибка удаления заметки: {str(e)}"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue