SSL error when calling SentinelAPI, certificate verification error
XinStoneSto opened this issue · comments
XinStoneSto commented
Hi all,
I am facing a SSL error while using Sentinelsat:
The code is written as:
api= SentinelAPI('user', 'password', 'https://apihub.copernicus.eu/apihub', show_progressbars= True)
result_length= []
sdate1= []
cloudcover= []
L= [3]
for i in L:
footprint= geojson_to_wkt (read_geojson (fr'Res{i}.geojson'))
#footprint= geojson_to_wkt (read_geojson (fr'reservoirs_0_{i}.geojson'))
#footprint= geojson_to_wkt (read_geojson ('Fushui.geojson'))
#Search for the product
products0 = api.query(footprint,
date= ('20190101', 'NOW'),
area_relation="Contains", #set to contains so that only patches include the entire shapefile will be downloaded
#'Intersects', 'Contains', 'IsWithin'
platformname= 'Sentinel-2',
processinglevel = 'Level-2A', #Products level, 'S2MSI2A' denotes for S2-L2A level
#area_relation= ('contains'),
cloudcoverpercentage= (0, 100))
And it is throwing error:
SSLError: HTTPSConnectionPool(host=‘apihub.copernicus.eu’, port=443): Max retries exceeded with url: /apihub/search?format=json&rows=100&start=0&q=beginPosition%3A%5B%222019-01-01T00%3A00%3A00Z%22+TO+%22NOW%22%5D+cloudcoverpercentage%3A%5B%220%22+TO+%22100%22%5D+platformname%3A%22Sentinel-2%22+processinglevel%3A%22Level-2A%22+footprint%3A%22Contains%28GEOMETRYCOLLECTION%28POLYGON%28%28107.2278+29.9018%2C107.4603+29.9018%2C107.4603+30.0721%2C107.2278+30.0721%2C107.2278+29.9018%29%29%29%29%22 (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)’)))
I am new to programming so I do not really understand how to tackle this problem, could you maybe elaborate a bit more?
So far I have tried:
pip install --upgrade certifi
tried to download the certificate from https://apihub.copernicus.eu/ and installed it by default
But nothing worked.
It would be great if anyone could help me on this.