slowly making it more better
parent
7c66c9eaf2
commit
155a0f7f14
|
@ -561,7 +561,8 @@ class Camera(Device):
|
|||
"Accept": "application/json"
|
||||
}
|
||||
|
||||
response = requests.get(url, headers=headers)
|
||||
try:
|
||||
response = requests.get(url, headers=headers, timeout=(3, 5))
|
||||
response_json = response.json()
|
||||
|
||||
logging.debug(f"{response.status_code} returned from {url} with {headers} and {response.text}")
|
||||
|
@ -585,6 +586,22 @@ class Camera(Device):
|
|||
else:
|
||||
success = False
|
||||
|
||||
except requests.exceptions.Timeout:
|
||||
logging.warn(f"timeout expired for {self.id} get_llist_of_events()")
|
||||
return {
|
||||
"success": False,
|
||||
"response_http_status": 0,
|
||||
"data": None
|
||||
}
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
logging.warn(e)
|
||||
return {
|
||||
"success": False,
|
||||
"response_http_status": 0,
|
||||
"data": None
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
"success": success,
|
||||
|
|
2
app.py
2
app.py
|
@ -122,7 +122,7 @@ def camera_live_preivew(esn=None):
|
|||
if res:
|
||||
return send_file(BytesIO(res.content), mimetype='image/jpeg')
|
||||
else:
|
||||
return send_file('static/placeholder1.png')
|
||||
return send_file('static/placeholder.png')
|
||||
|
||||
|
||||
@app.route('/camera/<esn>')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
<div class="col-md-3" id="camera_list_offline">
|
||||
<div class="col-md-3" id="camera_list_items">
|
||||
<h3>Online</h3>
|
||||
<ul>
|
||||
{% for camera in template_values['cameras'] %}
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block style %}
|
||||
<style>
|
||||
#camera_list_items {
|
||||
max-height: 500px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#events_list {
|
||||
max-height: 500px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block current_user %}
|
||||
|
|
Loading…
Reference in New Issue