From 8f23966289e9f346de9cce748a8e772da02a8728 Mon Sep 17 00:00:00 2001 From: kennybradley Date: Fri, 22 Oct 2021 23:54:35 -0700 Subject: [PATCH 1/2] Update camera.py Adding profile so sub can be used. This is useful for low power devices like raspberry pi. --- reolinkapi/camera.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reolinkapi/camera.py b/reolinkapi/camera.py index 98c208b..7371b20 100644 --- a/reolinkapi/camera.py +++ b/reolinkapi/camera.py @@ -8,6 +8,7 @@ class Camera(APIHandler): password: str = "", https: bool = False, defer_login: bool = False, + profile: str = "main", **kwargs): """ Initialise the Camera object by passing the ip address. @@ -23,6 +24,9 @@ class Camera(APIHandler): eg: {"http":"socks5://[username]:[password]@[host]:[port], "https": ...} More information on proxies in requests: https://stackoverflow.com/a/15661226/9313679 """ + if profile not in ["main", "sub"]: + raise Exception("Profile argument must be either \"main\" or \"sub\"") + # For when you need to connect to a camera behind a proxy, pass # a proxy argument: proxy={"http": "socks5://127.0.0.1:8000"} APIHandler.__init__(self, ip, username, password, https=https, **kwargs) @@ -33,6 +37,7 @@ class Camera(APIHandler): self.ip = ip self.username = username self.password = password + self.profile = profile if not defer_login: super().login() From 63f2cd78c927aa06064860442305dd86c08bc7fc Mon Sep 17 00:00:00 2001 From: kennybradley Date: Fri, 22 Oct 2021 23:55:16 -0700 Subject: [PATCH 2/2] Update stream.py Using the added profile argument. --- reolinkapi/mixins/stream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reolinkapi/mixins/stream.py b/reolinkapi/mixins/stream.py index 636856c..6798a42 100644 --- a/reolinkapi/mixins/stream.py +++ b/reolinkapi/mixins/stream.py @@ -23,7 +23,7 @@ try: :param proxies: Default is none, example: {"host": "localhost", "port": 8000} """ rtsp_client = RtspClient( - ip=self.ip, username=self.username, password=self.password, proxies=proxies, callback=callback) + ip=self.ip, username=self.username, password=self.password, profile=self.profile, proxies=proxies, callback=callback) return rtsp_client.open_stream() def get_snap(self, timeout: float = 3, proxies: Any = None) -> Optional[Image]: