diff --git a/service_plugins/cicakamera.py b/service_plugins/cicakamera.py index 5e41efc1a8109c5602795b4280a266b362708117..d9a948f441f782938c8e1ad455d55fdc1c724701 100755 --- a/service_plugins/cicakamera.py +++ b/service_plugins/cicakamera.py @@ -27,6 +27,8 @@ def cicakamera_img(**kwargs): if not services.authorize_user(session['username'], 'cicakamera'): return rqtools.get_403(None) totp = pyotp.TOTP(os.environ['CICASTREAMER_MASTER']).now() - r = requests.get("https://cica-stream.sferi.hu:8443/image", headers={"X-TOTP": totp}) - return Response(response=r.content, status=200, headers=[("Cache-Control", "no-store")], mimetype="image/jpeg") - + try: + r = requests.get("https://cica-stream.sferi.hu:8443/image", headers={"X-TOTP": totp}, timeout=1) + return Response(response=r.content, status=200, headers=[("Cache-Control", "no-store")], mimetype="image/jpeg") + except: + return rqtools.get_500(None, errormsg='Could not get image.')