diff --git a/scrape.py b/scrape.py index 4cfff20..dd223d4 100644 --- a/scrape.py +++ b/scrape.py @@ -202,10 +202,12 @@ def check_if_sas_token_is_present_for_collection_on_mpc(_collection_id: str) -> mpc_token_obtaining_url = token_url - # convert shapely_multipolygon_envelope to MultiPolygon - shapely_multipolygon_envelope = shapely.geometry.multipolygon.MultiPolygon( - [shapely_multipolygon_envelope] - ) + # convert shapely_multipolygon_envelope to MultiPolygon if it is not multipolygon + if not isinstance(shapely_multipolygon_envelope, shapely.geometry.multipolygon.MultiPolygon): + shapely_multipolygon_envelope = shapely.geometry.multipolygon.MultiPolygon( + [shapely_multipolygon_envelope] + ) + store_collection_in_database( results_catalog_url, results_collection_id,