Skip to content
Snippets Groups Projects
Commit 9e9ab7b9 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

attempt to evaluate the plots url first

parent 8bcdabf6
Branches
No related tags found
1 merge request!291Sdc 935 better plots
Pipeline #47731 passed
......@@ -3,7 +3,7 @@
Author: Nico Vermaas - Astron
Description: Business logic for ATDB. These functions are called from the views (views.py).
"""
import json
import requests
from datetime import datetime, timedelta
from django.db.models import Q, Sum
import logging
......@@ -708,6 +708,7 @@ def construct_inspectionplots(task,source='task_id'):
url = surl.replace(translation[0],translation[1])
results += '<tr><td><a href="' + url + '" target="_blank">'+ basename + '</a></td></tr>'
if basename.endswith('png'):
results += '<tr><td><a href="' + url + '" target="_blank"><img width="800" src="' + url + '" alt="' + basename + '"/></a></td></tr>'
......@@ -747,6 +748,12 @@ def construct_inspectionplots(task,source='task_id'):
results += '<tr><td><a href="' + url + '" target="_blank">' + basename + '</a></td></tr>'
if basename.endswith('png'):
# retrieve and evaluate the url first
response = requests.get(url)
if response.status_code!=200:
# try again
logger.error(response)
results += '<tr><td><a href="' + url + '" target="_blank"><img width="800" src="' + url + '" alt="'+basename+'"/></a></td></tr>'
plot_files.append(plot_file)
......
......@@ -34,7 +34,7 @@
{% include 'taskdatabase/pagination.html' %}
</div>
</div>
<p class="footer"> Version 6 April 2023
<p class="footer"> Version 14 April 2023
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment