reolinkapipy icon indicating copy to clipboard operation
reolinkapipy copied to clipboard

snap image returns empty despite IP ping working

Open fclairec opened this issue 3 years ago • 1 comments

Dear developers,

Thank you for all the efforts on this - really helpful. I am wondering if you could help me sove the following error (IPs make it impossible to make it reproducable). I am able to initialize the camera with cam = Camera(cam_ip, cam_settings.user, cam_settings.pw). However the login only works now and then - the cam.token will remain empty. Oddly enough the Ping (on the IP address works fine and the Reolink App is able to connect as well via the IP address)

When calling cam.get_snap() I get the following error:

  File "C:/Projekte/cam_api_calls/main.py", line 35, in fetch_all_images
    im = cam.get_snap()
  File "C:\Users\ge37mof\Anaconda3\envs\cam_fetcher\lib\site-packages\reolinkapi\mixins\stream.py", line 48, in get_snap
    return open_image(BytesIO(response.content))
  File "C:\Users\ge37mof\Anaconda3\envs\cam_fetcher\lib\site-packages\PIL\Image.py", line 2943, in open
    raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x0000016B17CA0D10>

Could you give me some hints on how to proceed on this? thanks in advance

fclairec avatar Mar 03 '22 18:03 fclairec

The Reolink software sucks when it comes to managing open connections. Is it possible you have a large number of open connections? Does the problem go away if you reboot the camera? What camera model are you using?

themoosman avatar Mar 03 '22 19:03 themoosman

The issue doesn't seem to be related to the library. It's up to your application logic how you handle connection timeouts and re-logins with the camera.

Benehiko avatar Dec 12 '23 20:12 Benehiko