Downloading data from SentinelSat

I tired to download sentinel L2A data and I got the following error.
This is the code I used:

# connect to the API

api = SentinelAPI('Rym', 'thedevilwearsparada', 'https://scihub.copernicus.eu/dhus')

footprint = geojson_to_wkt(read_geojson('Bizerte_FieldCampagn_Location.geojson')) 

products = api.query(footprint,

                        date = ('20180401','20180705'),

                        platformname = 'Sentinel-2',

                        processinglevel = 'Level-2A',

                        cloudcoverpercentage = (0, 5))

print(len(products))

# download all results from the search
api.download_all(products)
---------------------------------------------------------------------------
CancelledError                            Traceback (most recent call last)
<ipython-input-21-1da24c759dfe> in <module>()
     1 # download all results from the search
----> 2 api.download_all(products)

1 frames
/usr/lib/python3.6/concurrent/futures/_base.py in exception(self, timeout)
   454         with self._condition:
   455             if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
--> 456                 raise CancelledError()
   457             elif self._state == FINISHED:
   458                 return self._exception

CancelledError:

The thing is that it went well when I downloaded the data for 2020 and 2019.

Can it be related to the fact that older images are stored in a different archive and can no longer be directly provided? ESA Copernicus data access - Long Term Archive and its drawbacks

Some discussions on this here:

Stumbled on this thread while trying to find out why setting same date as start and end date in sentinelsat api query gives no products in result. Although there are products on the date.
Fixed this issue by setting end date as yyyy-MM-ddThh:mm:ssZ (https://sentinelsat.readthedocs.io/en/latest/api_reference.html). Hope this helps someone.

from datetime import datetime

today = datetime.today().strftime(’%Y%m%d’)
print(today)
now = datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
print(now)
footprint = geojson_to_wkt(read_geojson(‘path/to/your/footprint.geojson’))
products = api.query(footprint,
date=(today, now),
producttype=‘GRD’,
sensoroperationalmode=‘IW’)
print(products)

3 Likes