From f25b8ddc6ab34d089954eb4898d54220f7f2defa Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 17 Nov 2021 12:03:52 -0600 Subject: [PATCH] fix: Accept tar and zip headers in contrib.utils.download requests (#1704) * Add zip headers to the accepted content headers for contrib.utils.download * Amends PR #1697 Co-authored-by: Graeme Watt --- src/pyhf/contrib/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pyhf/contrib/utils.py b/src/pyhf/contrib/utils.py index 7d7dd1a744..b8d3d11023 100644 --- a/src/pyhf/contrib/utils.py +++ b/src/pyhf/contrib/utils.py @@ -66,10 +66,8 @@ def download(archive_url, output_directory, force=False, compress=False): # The HEPData landing page for the resource file can check if the Accept # request HTTP header matches the content type of the resource file and # return the content directly if so. - # TODO: Figure out how to accept headers of both application/x-tar and - # application/zip. with requests.get( - archive_url, headers={"Accept": "application/x-tar"} + archive_url, headers={"Accept": "application/x-tar, application/zip"} ) as response: if response.status_code != 200: raise exceptions.InvalidArchive(