Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong ONVIF token with Vivotek SD9161 #1

Open
b2ag opened this issue Jun 3, 2024 · 0 comments
Open

Wrong ONVIF token with Vivotek SD9161 #1

b2ag opened this issue Jun 3, 2024 · 0 comments

Comments

@b2ag
Copy link

b2ag commented Jun 3, 2024

Hi,

I stumbled upon media.GetProfiles()[0] returning a set instead of a token string and the SOAP library complaining about a type mismatch. Camera model is a Vivotek SD9161.

The following patch worked for me.

diff --git a/pyptz/onvif_control.py b/pyptz/onvif_control.py
index 89bacb7..329a25f 100644
--- a/pyptz/onvif_control.py
+++ b/pyptz/onvif_control.py
@@ -13,7 +13,7 @@ class ONVIFCamera:
         media = camera.create_media_service()
 
         self.__ptz = ptz
-        self.__token = media.GetProfiles()[0]
+        self.__token = media.GetProfiles()[0]['token']
 
     def absolute_move(self, pan: float, tilt: float, zoom: float):
         """

I didn't bother to include a type check. In fact there are no checks at all for if the thing returned is actually a set and has a key "token". So regard this as an real world example of a working config for this particular camera model and maybe integrate it with the necessary checks and a branch to old behavior if thing returned was a string and not a set.

Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant