#!/usr/bin/env python3 # -*- coding: utf-8 -*- import requests from exceptions import AppException def get_ptz_info(code: str): api_url = "http://10.181.7.166/GetPTZInfo" params = { "dev": code } response = requests.get(url=api_url, params=params, timeout=15) print(response.text) if response.status_code == 200: result = response.json() if result['Status'] == 0: data = result['Data'] return data #else: # raise AppException(1, "error") return { "AngelH": 0.0, "AngelV": 0.0, "AzimuthH": 0.0, "AzimuthV": 0.0, "Distance": 0.0, "InclinationH": 0.0, "PanPos": 0.0, "TiltPos": 0.0, "ZoomPos": 0.0 }