Commit 56104225 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski Committed by Leo P. Singer
Browse files

Fix downloading Fermi sky maps

parent 84f4e611
"""Create and upload LVC-Fermi sky maps."""
import re
import ssl
import urllib
from celery import group
from ligo.skymap.tool import ligo_skymap_combine
# import
import lxml.etree
from . import gracedb
......@@ -129,8 +130,14 @@ def get_external_skymap(heasarc_link):
trigger_id = re.sub(r'.*\/(\D+?)(\d+)(\D+)\/.*', r'\2', heasarc_link)
skymap_name = 'glg_healpix_all_bn{0}'.format(trigger_id)
skymap_link = heasarc_link + skymap_name
(skymap_link), encoding='binary', cache=False)
# FIXME: Under Anaconda on the LIGO Caltech computing cluster, Python
# (and curl, for that matter) fail to negotiate TLSv1.2 with
context = ssl.create_default_context()
context.options |= ssl.OP_NO_TLSv1_3
# return
# (skymap_link), encoding='binary', cache=False)
return urllib.request.urlopen(skymap_link, context=context).read()
@app.task(autoretry_for=(urllib.error.HTTPError,), retry_backoff=10,
......@@ -91,13 +91,12 @@ def test_external_trigger_heasarc(mock_download):
assert heasarc_link == true_heasarc_link
def test_get_external_skymap(mock_astropy_get_file_contents):
def test_get_external_skymap(mock_urlopen):
"""Assert that the correct call to astropy.get_file_contents is used"""
(true_skymap_link), encoding='binary', cache=False)
def test_get_upload_external_skymap():
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment