Skip to content

Commit

Permalink
fix: Accept tar and zip headers in contrib.utils.download requests (#…
Browse files Browse the repository at this point in the history
…1704)

* Add zip headers to the accepted content headers for contrib.utils.download
* Amends PR #1697

Co-authored-by: Graeme Watt <Graeme.Watt@durham.ac.uk>
  • Loading branch information
matthewfeickert and GraemeWatt authored Nov 17, 2021
1 parent d4b2d9c commit f25b8dd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/pyhf/contrib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f25b8dd

Please sign in to comment.