diff --git a/oda_api/data_products.py b/oda_api/data_products.py index 9182e116..d510a67e 100644 --- a/oda_api/data_products.py +++ b/oda_api/data_products.py @@ -41,7 +41,7 @@ from sys import path_importer_cache, version_info from io import StringIO, BytesIO -import imghdr +import puremagic import os import logging from matplotlib import image as mpimg @@ -850,7 +850,7 @@ def __init__(self, binary_data, name=None, metadata={}, file_path=None, write_on else: self.file_path = None byte_stream = BytesIO(binary_data) - tp = imghdr.what(byte_stream) + tp = puremagic.what(byte_stream) if tp is None: raise ValueError('Provided data is not an image') self.img_type = tp diff --git a/pyproject.toml b/pyproject.toml index 38443c1d..052f01c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,8 @@ dependencies = [ "astroquery", "scipy", "rdflib", - "black" + "black", + "puremagic" ] [project.optional-dependencies]