PTZApi.py 787 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. import requests
  4. from exceptions import AppException
  5. def get_ptz_info(code: str):
  6. api_url = "http://10.181.7.166/GetPTZInfo"
  7. params = {
  8. "dev": code
  9. }
  10. response = requests.get(url=api_url, params=params, timeout=15)
  11. print(response.text)
  12. if response.status_code == 200:
  13. result = response.json()
  14. if result['Status'] == 0:
  15. data = result['Data']
  16. return data
  17. #else:
  18. # raise AppException(1, "error")
  19. return {
  20. "AngelH": 0.0,
  21. "AngelV": 0.0,
  22. "AzimuthH": 0.0,
  23. "AzimuthV": 0.0,
  24. "Distance": 0.0,
  25. "InclinationH": 0.0,
  26. "PanPos": 0.0,
  27. "TiltPos": 0.0,
  28. "ZoomPos": 0.0
  29. }